It is better to init jresp as NULL, and allocate new memory when it is
used, this will avoid the memory leak if the function returns during the
process.
Bug-AGL: SPEC-3584
Change-Id: Icb1eae050294f4438ad89739e324c5483b6b3441
Signed-off-by: Li Xiaoming <lixm.fnst@cn.fujitsu.com>
gboolean unsub)
{
struct navigation_state *ns = navigation_get_userdata();
- json_object *jresp = json_object_new_object();
+ json_object *jresp = NULL;
const char *value;
afb_event_t event;
int rc;
return;
}
+ jresp = json_object_new_object();
afb_req_success_f(request, jresp, "Navigation %s to event \"%s\"",
!unsub ? "subscribed" : "unsubscribed",
value);