fix tiny memory leak
[src/app-framework-binder.git] / src / afb-svc.c
index 95617d5..74f32ec 100644 (file)
@@ -133,6 +133,7 @@ struct afb_svc *afb_svc_create(int share_session, int (*init)(struct afb_service
        }
 
        /* initialises the listener if needed */
+       svc->on_event = on_event;
        if (on_event == NULL)
                svc->listener = NULL;
        else {
@@ -165,6 +166,7 @@ error:
 static void svc_on_event(struct afb_svc *svc, const char *event, int eventid, struct json_object *object)
 {
        svc->on_event(event, object);
+       json_object_put(object);
 }
 
 /*