cJSON: Add memory leak patch

This commit is contained in:
Nathan Owens 2019-12-06 18:46:05 -06:00 committed by Juan RP
parent fb65e735a8
commit c7e8d3b87a
2 changed files with 25 additions and 1 deletions

View file

@ -0,0 +1,24 @@
From 7b65bd348da0411f2d6db12f21f7562e7286416c Mon Sep 17 00:00:00 2001
From: Alanscut <wp_scut@163.com>
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 cJSON_Utils.c cJSON_Utils.c
index 7df4db2..b890d17 100644
--- cJSON_Utils.c
+++ 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); /* /<array_index><path> */
--
2.24.0

View file

@ -1,7 +1,7 @@
# Template file for 'cJSON'
pkgname=cJSON
version=1.7.12
revision=1
revision=2
build_style=cmake
short_desc="Ultralightweight JSON parser in ANSI C"
maintainer="Orphaned <orphan@voidlinux.org>"