X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-api-dbus.c;h=62a83de0b42aa50de2a30fe73b63767f1e35321a;hb=c44a48f295de04e4d0385b05d1afd93fac898d10;hp=4c5d90835ea08cf403cddddcd0dfbed27360e95f;hpb=39c2ebc125fcc694ac349ae196b62729c7f05037;p=src%2Fapp-framework-binder.git diff --git a/src/afb-api-dbus.c b/src/afb-api-dbus.c index 4c5d9083..62a83de0 100644 --- a/src/afb-api-dbus.c +++ b/src/afb-api-dbus.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2015, 2016 "IoT.bzh" * Author José Bollo * @@ -26,7 +26,6 @@ #include #include -#include #include #include "afb-common.h" @@ -800,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); } @@ -938,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)