summaryrefslogtreecommitdiffstats
path: root/signal-composer-binding/signal-composer-binding.cpp
diff options
context:
space:
mode:
authorLi Xiaoming <lixm.fnst@cn.fujitsu.com>2021-01-25 18:05:05 +0800
committerLi Xiaoming <lixm.fnst@cn.fujitsu.com>2021-01-25 18:05:05 +0800
commit60fe4f88ccb96f9fa9053a433c8d74bb3bcfb6bc (patch)
tree8781dbf214a2b357f50c14935a994fc8f831209d /signal-composer-binding/signal-composer-binding.cpp
parent70948a636aa863838e0cbb46acf5de186298c140 (diff)
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>
Diffstat (limited to 'signal-composer-binding/signal-composer-binding.cpp')
-rw-r--r--signal-composer-binding/signal-composer-binding.cpp9
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.