diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/afm-main-plugin/afm-main-plugin.c | 2 | ||||
-rw-r--r-- | plugins/afm-main-plugin/utils-jbus.c | 18 | ||||
-rw-r--r-- | plugins/afm-main-plugin/utils-jbus.h | 1 |
3 files changed, 16 insertions, 5 deletions
diff --git a/plugins/afm-main-plugin/afm-main-plugin.c b/plugins/afm-main-plugin/afm-main-plugin.c index 56439905..bca28fe0 100644 --- a/plugins/afm-main-plugin/afm-main-plugin.c +++ b/plugins/afm-main-plugin/afm-main-plugin.c @@ -85,7 +85,7 @@ static AFB_plugin plug_desc = { AFB_plugin *pluginRegister() { - jbus = create_jbus(1, "/org/AGL/afmMain"); + jbus = create_jbus(1, "/org/AGL/afm/user"); return jbus ? &plug_desc : NULL; } diff --git a/plugins/afm-main-plugin/utils-jbus.c b/plugins/afm-main-plugin/utils-jbus.c index 7e65723a..d58def90 100644 --- a/plugins/afm-main-plugin/utils-jbus.c +++ b/plugins/afm-main-plugin/utils-jbus.c @@ -272,6 +272,7 @@ static DBusHandlerResult incoming_resp(DBusConnection *connection, DBusMessage * reply = json_tokener_parse(str); status = reply ? 0 : -1; jrw->onresp_j(iserror ? -1 : status, reply, jrw->data); + json_object_put(reply); } free(jrw); @@ -318,6 +319,7 @@ static DBusHandlerResult incoming_call(DBusConnection *connection, DBusMessage * if (query == NULL) return reply_invalid_request(jreq); srv->oncall_j(jreq, query); + json_object_put(query); } return DBUS_HANDLER_RESULT_HANDLED; } @@ -350,8 +352,10 @@ static DBusHandlerResult incoming_signal(DBusConnection *connection, DBusMessage else { /* handling json only */ obj = json_tokener_parse(str); - if (obj != NULL) + if (obj != NULL) { sig->onsignal_j(obj); + json_object_put(obj); + } } } return DBUS_HANDLER_RESULT_HANDLED; @@ -607,11 +611,17 @@ char *jbus_call_ss_sync(struct jbus *jbus, const char *method, const char *query struct json_object *jbus_call_sj_sync(struct jbus *jbus, const char *method, const char *query) { - const char *str = jbus_call_ss_sync(jbus, method, query); - return str ? json_tokener_parse(str) : NULL; + struct json_object *obj; + char *str = jbus_call_ss_sync(jbus, method, query); + if (str == NULL) + obj = NULL; + else { + obj = json_tokener_parse(str); + free(str); + } + return obj; } - char *jbus_call_js_sync(struct jbus *jbus, const char *method, struct json_object *query) { const char *str = json_object_to_json_string(query); diff --git a/plugins/afm-main-plugin/utils-jbus.h b/plugins/afm-main-plugin/utils-jbus.h index 68e9b68a..218c21d6 100644 --- a/plugins/afm-main-plugin/utils-jbus.h +++ b/plugins/afm-main-plugin/utils-jbus.h @@ -51,3 +51,4 @@ extern int jbus_add_service_j(struct jbus *jbus, const char *method, void (*onca extern int jbus_start_serving(struct jbus *jbus); extern int jbus_send_signal_s(struct jbus *jbus, const char *name, const char *content); extern int jbus_send_signal_j(struct jbus *jbus, const char *name, struct json_object *content); + |