!9 fix memory leaks in yajl_tree_parse
From: @fly_fzc Reviewed-by: @xiezhipeng1 Signed-off-by: @xiezhipeng1
This commit is contained in:
commit
12cd93862d
26
backport-fix-memory-leaks.patch
Normal file
26
backport-fix-memory-leaks.patch
Normal file
@ -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
|
||||
|
||||
@ -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 <fuanan3@h-partners.com> - 2.1.0-15
|
||||
- fix memory leaks in yajl_tree_parse
|
||||
|
||||
* Tue Jun 8 2021 panxiaohe<panxiaohe@huawei.com> - 2.1.0-14
|
||||
- add gcc to BuildRequires
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user