diff --git a/yajl-2.1.0-pkgconfig-location.patch b/0001-yajl-2.1.0-pkgconfig-location.patch similarity index 100% rename from yajl-2.1.0-pkgconfig-location.patch rename to 0001-yajl-2.1.0-pkgconfig-location.patch diff --git a/yajl-2.1.0-pkgconfig-includedir.patch b/0002-yajl-2.1.0-pkgconfig-includedir.patch similarity index 100% rename from yajl-2.1.0-pkgconfig-includedir.patch rename to 0002-yajl-2.1.0-pkgconfig-includedir.patch diff --git a/yajl-2.1.0-test-location.patch b/0003-yajl-2.1.0-test-location.patch similarity index 100% rename from yajl-2.1.0-test-location.patch rename to 0003-yajl-2.1.0-test-location.patch diff --git a/yajl-2.1.0-dynlink-binaries.patch b/0004-yajl-2.1.0-dynlink-binaries.patch similarity index 100% rename from yajl-2.1.0-dynlink-binaries.patch rename to 0004-yajl-2.1.0-dynlink-binaries.patch diff --git a/yajl-2.1.0-fix-memory-leak.patch b/0005-yajl-2.1.0-fix-memory-leak.patch similarity index 100% rename from yajl-2.1.0-fix-memory-leak.patch rename to 0005-yajl-2.1.0-fix-memory-leak.patch diff --git a/backport-fix-memory-leaks.patch b/0006-fix-memory-leak-of-ctx-root.patch similarity index 36% rename from backport-fix-memory-leaks.patch rename to 0006-fix-memory-leak-of-ctx-root.patch index c5817a1ac33369f9773d588fa7808cbf7b5979b6..6d268f5e37ece901aa3953e80641dd7542957b0b 100644 --- a/backport-fix-memory-leaks.patch +++ b/0006-fix-memory-leak-of-ctx-root.patch @@ -1,26 +1,27 @@ -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 +From d6d0aeb5f6432763929d4096344ec2caf6d13d89 Mon Sep 17 00:00:00 2001 +From: haozi007 +Date: Sat, 28 May 2022 10:06:46 +0100 +Subject: [PATCH] fix memory leak of ctx root +Signed-off-by: haozi007 --- 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 +index 4b3cf2b..dc55f74 100644 --- a/src/yajl_tree.c +++ b/src/yajl_tree.c -@@ -456,6 +456,9 @@ yajl_val yajl_tree_parse (const char *input, +@@ -449,6 +449,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); ++ //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 +2.20.1 diff --git a/0007-add-cmake-option-for-test-and-binary.patch b/0007-add-cmake-option-for-test-and-binary.patch new file mode 100644 index 0000000000000000000000000000000000000000..d325f2510640222cb2440875e6bd027ca39cc2c7 --- /dev/null +++ b/0007-add-cmake-option-for-test-and-binary.patch @@ -0,0 +1,54 @@ +From 255917e92717c491ffb66eb63a3333682d13df60 Mon Sep 17 00:00:00 2001 +From: haozi007 +Date: Wed, 8 Jun 2022 07:27:46 +0100 +Subject: [PATCH] add cmake option for test and binary + +Signed-off-by: haozi007 +--- + CMakeLists.txt | 27 ++++++++++++++++++--------- + 1 file changed, 18 insertions(+), 9 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4c0a9be..9cc63c5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -64,18 +64,27 @@ ENDIF (WIN32) + + + ADD_SUBDIRECTORY(src) +-ADD_SUBDIRECTORY(test) +-ADD_SUBDIRECTORY(reformatter) +-ADD_SUBDIRECTORY(verify) ++ ++IF (NOT DISABLE_TEST) ++ ADD_SUBDIRECTORY(test) ++ENDIF () ++ ++IF (NOT DISABLE_BIN) ++ ADD_SUBDIRECTORY(reformatter) ++ ADD_SUBDIRECTORY(verify) ++ENDIF () ++ + ADD_SUBDIRECTORY(example) + ADD_SUBDIRECTORY(perf) + + INCLUDE(YAJLDoc.cmake) + +-# a test target +-ADD_CUSTOM_TARGET(test +- ./run_tests.sh ${CMAKE_CURRENT_BINARY_DIR}/test/parsing/yajl_test +- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test/parsing) ++IF (NOT DISABLE_TEST) ++ # a test target ++ ADD_CUSTOM_TARGET(test ++ ./run_tests.sh ${CMAKE_CURRENT_BINARY_DIR}/test/parsing/yajl_test ++ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test/parsing) + +-ADD_CUSTOM_TARGET(test-api ${CMAKE_CURRENT_SOURCE_DIR}/test/api/run_tests.sh +- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test/api) ++ ADD_CUSTOM_TARGET(test-api ${CMAKE_CURRENT_SOURCE_DIR}/test/api/run_tests.sh ++ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test/api) ++ENDIF () +-- +2.20.1 + diff --git a/yajl.spec b/yajl.spec index f8b66866391cde3382970a05a7536b20b1f221a2..ce3ef079dfb064b601f67d183ccb322c5f3c4338 100644 --- a/yajl.spec +++ b/yajl.spec @@ -1,17 +1,18 @@ Name: yajl Version: 2.1.0 -Release: 15 +Release: 16 Summary: Yet Another JSON Library License: ISC URL: http://lloyd.github.com/yajl/ Source0: https://github.com/lloyd/yajl/archive/%{version}.tar.gz -Patch1: yajl-2.1.0-pkgconfig-location.patch -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 +Patch1: 0001-yajl-2.1.0-pkgconfig-location.patch +Patch2: 0002-yajl-2.1.0-pkgconfig-includedir.patch +Patch3: 0003-yajl-2.1.0-test-location.patch +Patch4: 0004-yajl-2.1.0-dynlink-binaries.patch +Patch5: 0005-yajl-2.1.0-fix-memory-leak.patch +Patch6: 0006-fix-memory-leak-of-ctx-root.patch +Patch7: 0007-add-cmake-option-for-test-and-binary.patch BuildRequires: cmake gcc @@ -68,6 +69,9 @@ cd ../api %{_libdir}/libyajl_s.a %changelog +* Wed Jun 8 2022 haozi007 - 2.1.0-16 +- add index for patch and add cmake options + * Sat Feb 12 2022 fuanan - 2.1.0-15 - fix memory leaks in yajl_tree_parse