Close and delete JSON object only after output of SFP diagnostics so that it is also JSON formatted. If the JSON object is deleted too early, some of the output will not be JSON formatted, resulting in mixed output formats. Signed-off-by: Johannes Eigner --- sfpid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sfpid.c b/sfpid.c index 62acb4f..5216ce3 100644 --- a/sfpid.c +++ b/sfpid.c @@ -520,8 +520,6 @@ int sff8079_show_all_nl(struct cmd_context *ctx) new_json_obj(ctx->json); open_json_object(NULL); sff8079_show_all_common(buf); - close_json_object(); - delete_json_obj(); /* Finish if A2h page is not present */ if (!(buf[92] & (1 << 6))) @@ -537,6 +535,8 @@ int sff8079_show_all_nl(struct cmd_context *ctx) sff8472_show_all(buf); out: + close_json_object(); + delete_json_obj(); free(buf); return ret; -- 2.43.0