aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-08-03 15:13:21 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-08-03 15:13:21 +0200
commit8e62dd65bcc04910e46f47fb8f098d37f19f25c4 (patch)
treeb76716b5d065a0567f347d866a8da76e9907e7c0
parent574c9987543b2b615a8ebdeda2b35062b0730742 (diff)
api-dbus: improves 'dbus_req_json'
Change-Id: I6d63d70d30f02422e5f9904722e89f92358186b9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-api-dbus.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/afb-api-dbus.c b/src/afb-api-dbus.c
index 53bc2dcc..62a83de0 100644
--- a/src/afb-api-dbus.c
+++ b/src/afb-api-dbus.c
@@ -799,7 +799,7 @@ static struct json_object *dbus_req_json(struct dbus_req *dreq)
{
if (dreq->json == NULL) {
dreq->json = json_tokener_parse(dreq->request);
- if (dreq->json == NULL) {
+ if (dreq->json == NULL && strcmp(dreq->request, "null")) {
/* lazy error detection of json request. Is it to improve? */
dreq->json = json_object_new_string(dreq->request);
}
@@ -937,6 +937,7 @@ static void afb_api_dbus_server_event_push(void *closure, const char *event, int
{
const char *data = json_object_to_json_string_ext(object, JSON_C_TO_STRING_PLAIN);
afb_api_dbus_server_event_send(closure, '!', event, eventid, data, 0);
+ json_object_put(object);
}
static void afb_api_dbus_server_event_broadcast(void *closure, const char *event, int eventid, struct json_object *object)