From 66de35a9b1170815e51005996441318bd9574e68 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 23 May 2025 15:09:07 +0200 Subject: json: Fix minor memory leak. * src/json-core.c (json_core_process_request): Fix leak and worng formatting in interactive mode in case of an error. --- src/json-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/json-core.c') diff --git a/src/json-core.c b/src/json-core.c index 174f182e..4657b616 100644 --- a/src/json-core.c +++ b/src/json-core.c @@ -3136,7 +3136,8 @@ json_core_process_request (ctrl_t ctrl, const char *request) err_obj = error_object (NULL, "Printing JSON data failed"); if (ctrl->interactive) res = cJSON_Print (err_obj); - res = cJSON_PrintUnformatted (err_obj); + else + res = cJSON_PrintUnformatted (err_obj); cJSON_Delete (err_obj); } -- cgit v1.2.3