aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2025-05-23 13:09:07 +0000
committerWerner Koch <[email protected]>2025-05-23 13:09:07 +0000
commit66de35a9b1170815e51005996441318bd9574e68 (patch)
treecba69f80ba0dae14926194e196dab9d1132ca6dd /src
parentRefactor gpgme-json for future re-use. (diff)
downloadgpgme-66de35a9b1170815e51005996441318bd9574e68.tar.gz
gpgme-66de35a9b1170815e51005996441318bd9574e68.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/json-core.c3
1 files changed, 2 insertions, 1 deletions
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);
}