summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi, Xiaoming <lixm.fnst@cn.fujitsu.com>2021-01-13 15:27:09 +0800
committerLi Xiaoming <lixm.fnst@cn.fujitsu.com>2021-01-14 01:57:32 +0000
commit4f650f1d88ef43c4befc2b035275f294a3c2d43f (patch)
tree386a140f39bff16e7368fb587fe2ec78c1e1a984
parentb0437544e55246ddd8f084c9c7415b3103ce285c (diff)
In some cases, j_query or j_array maybe unfreed after return; Bug-AGL: SPEC-3584 Change-Id: I4bb7ff5eb51aa77d4419440701faaab8c26bc8cf Signed-off-by: Li, Xiaoming <lixm.fnst@cn.fujitsu.com>
-rw-r--r--binding/wrap-unicens/wrap-unicens.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/binding/wrap-unicens/wrap-unicens.c b/binding/wrap-unicens/wrap-unicens.c
index 84b94cd..e27d999 100644
--- a/binding/wrap-unicens/wrap-unicens.c
+++ b/binding/wrap-unicens/wrap-unicens.c
@@ -154,6 +154,10 @@ extern int wrap_ucs_i2cwrite_sync(uint16_t node, uint8_t *data_ptr, uint8_t data
j_array = json_object_new_array();
if(! j_query || ! j_array) {
+ if (j_query)
+ json_object_put(j_query);
+ if (j_array)
+ json_object_put(j_array);
AFB_API_ERROR(api_handle_, "Failed to create writei2c json objects");
return -1;
}