summaryrefslogtreecommitdiffstats
path: root/binding/bluetooth-map-api.c
diff options
context:
space:
mode:
authorLi Xiaoming <lixm.fnst@cn.fujitsu.com>2021-02-24 18:45:17 +0800
committerLi Xiaoming <lixm.fnst@cn.fujitsu.com>2021-02-24 18:45:17 +0800
commit303e9302dffc61baba1dbf4f08a8e80883a70b2a (patch)
treec47034d2950755069b42889dafcb3e6e98e0d2ef /binding/bluetooth-map-api.c
parentd98644e4551f909a3b16c935e64188459b948cc7 (diff)
json structure allocating code should be placed in where it is used, if there is a condition check which may cause a return before the before-mentioned place in the function. Bug-AGL: SPEC-3584 Change-Id: I9b5228c62a7e3bef055d7bdb0950d2bd4e058265 Signed-off-by: Li Xiaoming <lixm.fnst@cn.fujitsu.com>
Diffstat (limited to 'binding/bluetooth-map-api.c')
-rw-r--r--binding/bluetooth-map-api.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/binding/bluetooth-map-api.c b/binding/bluetooth-map-api.c
index b0a97d7..512630e 100644
--- a/binding/bluetooth-map-api.c
+++ b/binding/bluetooth-map-api.c
@@ -236,7 +236,7 @@ static void map_subscribe_unsubscribe(afb_req_t request,
gboolean unsub)
{
struct map_state *ns = map_get_userdata(request);
- json_object *jresp = json_object_new_object();
+ json_object *jresp;
const char *value;
afb_event_t event;
int rc;
@@ -268,6 +268,7 @@ static void map_subscribe_unsubscribe(afb_req_t request,
return;
}
+ jresp = json_object_new_object();
afb_req_success_f(request, jresp, "Bluetooth MAP %s to event \"%s\"",
!unsub ? "subscribed" : "unsubscribed",
value);