From 23828147c693ba063cb718b3db92f175d7e11abf Mon Sep 17 00:00:00 2001 From: fuanan <2385803914@qq.com> Date: Sat, 12 Feb 2022 10:43:01 +0800 Subject: [PATCH] fix memory leaks in yajl_tree_parse --- backport-fix-memory-leaks.patch | 26 ++++++++++++++++++++++++++ yajl.spec | 6 +++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 backport-fix-memory-leaks.patch diff --git a/backport-fix-memory-leaks.patch b/backport-fix-memory-leaks.patch new file mode 100644 index 0000000..c5817a1 --- /dev/null +++ b/backport-fix-memory-leaks.patch @@ -0,0 +1,26 @@ +From 23a122eddaa28165a6c219000adcc31ff9a8a698 Mon Sep 17 00:00:00 2001 +From: "zhang.jiujiu" <282627424@qq.com> +Date: Tue, 7 Dec 2021 22:37:02 +0800 +Subject: [PATCH] fix memory leaks + +--- + src/yajl_tree.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/yajl_tree.c b/src/yajl_tree.c +index b9e6604..0e7bde9 100644 +--- a/src/yajl_tree.c ++++ b/src/yajl_tree.c +@@ -456,6 +456,9 @@ yajl_val yajl_tree_parse (const char *input, + yajl_tree_free(v); + } + yajl_free (handle); ++ //If the requested memory is not released in time, it will cause memory leakage ++ if(ctx.root) ++ yajl_tree_free(ctx.root); + return NULL; + } + +-- +1.8.3.1 + diff --git a/yajl.spec b/yajl.spec index ac20275..f8b6686 100644 --- a/yajl.spec +++ b/yajl.spec @@ -1,6 +1,6 @@ Name: yajl Version: 2.1.0 -Release: 14 +Release: 15 Summary: Yet Another JSON Library License: ISC URL: http://lloyd.github.com/yajl/ @@ -11,6 +11,7 @@ Patch2: yajl-2.1.0-pkgconfig-includedir.patch Patch3: yajl-2.1.0-test-location.patch Patch4: yajl-2.1.0-dynlink-binaries.patch Patch5: yajl-2.1.0-fix-memory-leak.patch +Patch6: backport-fix-memory-leaks.patch BuildRequires: cmake gcc @@ -67,6 +68,9 @@ cd ../api %{_libdir}/libyajl_s.a %changelog +* Sat Feb 12 2022 fuanan - 2.1.0-15 +- fix memory leaks in yajl_tree_parse + * Tue Jun 8 2021 panxiaohe - 2.1.0-14 - add gcc to BuildRequires -- Gitee