diff options
author | Li Xiaoming <lixm.fnst@cn.fujitsu.com> | 2021-01-25 18:05:05 +0800 |
---|---|---|
committer | Li Xiaoming <lixm.fnst@cn.fujitsu.com> | 2021-01-25 18:05:05 +0800 |
commit | 60fe4f88ccb96f9fa9053a433c8d74bb3bcfb6bc (patch) | |
tree | 8781dbf214a2b357f50c14935a994fc8f831209d | |
parent | 70948a636aa863838e0cbb46acf5de186298c140 (diff) |
Fix potential memory leakneedlefish_13.93.0needlefish/13.93.0marlin_12.93.0marlin_12.92.0marlin_12.91.0marlin_12.90.1marlin_12.90.0marlin/12.93.0marlin/12.92.0marlin/12.91.0marlin/12.90.1marlin/12.90.0lamprey_11.92.0lamprey_11.91.0lamprey/11.92.0lamprey/11.91.0koi_10.93.0koi/10.93.013.93.012.93.012.92.012.91.012.90.112.90.011.92.011.91.010.93.0
allSignalsJ should be freed before function returns if its owership
is not transfered.
Bug-AGL: SPEC-3584
Change-Id: Ie6ff72684300b04297a2d314121807a0d1cbf1c3
Signed-off-by: Li Xiaoming <lixm.fnst@cn.fujitsu.com>
-rw-r--r-- | signal-composer-binding/signal-composer-binding.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/signal-composer-binding/signal-composer-binding.cpp b/signal-composer-binding/signal-composer-binding.cpp index b28d8ec..9009162 100644 --- a/signal-composer-binding/signal-composer-binding.cpp +++ b/signal-composer-binding/signal-composer-binding.cpp @@ -212,9 +212,14 @@ void list(afb_req_t request) {json_object_array_add(allSignalsJ, sig->toJSON());} if(json_object_array_length(allSignalsJ)) - {afb_req_success(request, allSignalsJ, NULL);} + { + afb_req_success(request, allSignalsJ, NULL); + } else - {afb_req_fail(request, "error", "No Signals recorded so far");} + { + json_object_put(allSignalsJ); + afb_req_fail(request, "error", "No Signals recorded so far"); + } } /// @brief entry point for get requests. |