diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-04-24 15:21:57 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-12-13 15:02:54 +0100 |
commit | 7a16886211615020d968fe408cd0c3ea09c0deb7 (patch) | |
tree | d281ff1810b7d47050b1756d86ef3adb1edd293a /ctl-lib | |
parent | 461740315df4d0aa8d90d9a42dddbf128c51939c (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.c | 4 |
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; } } |