From ebe5137382756175f796082b80a977e099573d47 Mon Sep 17 00:00:00 2001 From: vdutta Date: Tue, 28 Jun 2022 14:37:32 +0530 Subject: [PATCH] Fix probable crash --- dmdiagnostics.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dmdiagnostics.c b/dmdiagnostics.c index b52640c4..1aeed9bb 100644 --- a/dmdiagnostics.c +++ b/dmdiagnostics.c @@ -671,10 +671,12 @@ end: // Remove temporary file if ubus upgrade failed and file exists if (!json_obj && file_exists(fw_image_path) && strncmp(url, FILE_URI, strlen(FILE_URI))) { remove(fw_image_path); - json_object_put(json_obj); res = -1; } + if (json_obj != NULL) + json_object_put(json_obj); + return res; }