From a92c543fd574e027f0de0bd17d8a67090364ef3d Mon Sep 17 00:00:00 2001 From: Yan Chen Date: Fri, 7 Dec 2018 00:47:21 +0800 Subject: [PATCH] No json_object_put() for the json_obj created by json_object_object_get_ex(). It is stated in the json_object.h from version 0.11: https://github.com/json-c/json-c/blob/json-c-0.11/json_object.h#L271 As on json-c 0.11, there's no assert to check for the ref_count, we wont get crashed. But on json-c 0.13.1 (latest release), json_object_put will check for the ref_count first, so mtcAgent will crash. Test Done: Run mtcAgent with json-c version 0.13.1 with this patch, no crash found. Closes-Bug: 1807097 Change-Id: I7f954c97804ae01f831c94a36b9dbdbb34dbf083 Signed-off-by: Yan Chen --- mtce-common/src/common/jsonUtil.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mtce-common/src/common/jsonUtil.cpp b/mtce-common/src/common/jsonUtil.cpp index 092c8387..680a0eaa 100644 --- a/mtce-common/src/common/jsonUtil.cpp +++ b/mtce-common/src/common/jsonUtil.cpp @@ -920,12 +920,6 @@ auth_load_cleanup: } json_object_put(raw_obj); } - if (token_obj) json_object_put(token_obj); - if (svccat_obj) json_object_put(svccat_obj); - if (tuple_obj) json_object_put(tuple_obj); - if (end_obj) json_object_put(end_obj); - if (url_obj) json_object_put(type_obj); - if (type_obj) json_object_put(type_obj); return (rc); }