summaryrefslogtreecommitdiffstats
path: root/ctl-lib
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-04-24 15:21:57 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-04-25 10:14:05 +0200
commit8ff0fe3c454ea32ba383a3cfa9c4e91237d6c494 (patch)
treed281ff1810b7d47050b1756d86ef3adb1edd293a /ctl-lib
parent1bca1b097f423a2b2b94b4dcf3cbacf491b070c5 (diff)
Release json_objects used to launched the action
Instead of only have API subcall releasing the json_object now release in all cases to be coherent. This should be argument to be passed to an action, treated in that action then after that has been done, this object has no more meanings and should be released. Change-Id: I371f0c3db34f4126a812d70b7e3ccb9f8bb5f776 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib')
-rw-r--r--ctl-lib/ctl-action.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ctl-lib/ctl-action.c b/ctl-lib/ctl-action.c
index 3158500..277591d 100644
--- a/ctl-lib/ctl-action.c
+++ b/ctl-lib/ctl-action.c
@@ -89,6 +89,7 @@ PUBLIC void ActionExecOne(CtlSourceT *source, CtlActionT* action, json_object *q
json_object_object_add(subcallArgsJ, "uid", json_object_new_string(source->uid));
+ /* AFB Subcall will release the json_object doing the json_object_put() call */
int err = AFB_ServiceSync(action->api, action->exec.subcall.api, action->exec.subcall.verb, subcallArgsJ, &returnJ);
if (err) {
AFB_ApiError(action->api, "ActionExecOne(AppFw) uid=%s api=%s verb=%s args=%s", source->uid, action->exec.subcall.api, action->exec.subcall.verb, json_object_get_string(action->argsJ));
@@ -102,6 +103,7 @@ PUBLIC void ActionExecOne(CtlSourceT *source, CtlActionT* action, json_object *q
if (err) {
AFB_ApiError(action->api, "ActionExecOne(Lua) uid=%s func=%s args=%s", source->uid, action->exec.lua.funcname, json_object_get_string(action->argsJ));
}
+ json_object_put(queryJ);
break;
#endif
@@ -110,11 +112,13 @@ PUBLIC void ActionExecOne(CtlSourceT *source, CtlActionT* action, json_object *q
if (err) {
AFB_ApiError(action->api, "ActionExecOne(Callback) uid%s plugin=%s function=%s args=%s", source->uid, action->exec.cb.plugin->uid, action->exec.cb.funcname, json_object_get_string(action->argsJ));
}
+ json_object_put(queryJ);
break;
default:
{
AFB_ApiError(action->api, "ActionExecOne(unknown) API type uid=%s", source->uid);
+ json_object_put(queryJ);
break;
}
}