From 500a9db81bca54027ce8de2ce42b48fa89782e78 Mon Sep 17 00:00:00 2001 From: Alanscut Date: Thu, 5 Dec 2019 11:05:07 +0800 Subject: [PATCH] fix memory leak mentioned in issue 414 --- cJSON_Utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cJSON_Utils.c b/cJSON_Utils.c index 7df4db2..b890d17 100644 --- a/cJSON_Utils.c +++ b/cJSON_Utils.c @@ -216,6 +216,7 @@ CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(const cJSON * const obje if (child_index > ULONG_MAX) { cJSON_free(target_pointer); + cJSON_free(full_pointer); return NULL; } sprintf((char*)full_pointer, "/%lu%s", (unsigned long)child_index, target_pointer); /* / */