diff options
author | Li Xiaoming <lixm.fnst@cn.fujitsu.com> | 2021-02-24 18:45:17 +0800 |
---|---|---|
committer | Li Xiaoming <lixm.fnst@cn.fujitsu.com> | 2021-02-24 18:45:17 +0800 |
commit | 303e9302dffc61baba1dbf4f08a8e80883a70b2a (patch) | |
tree | c47034d2950755069b42889dafcb3e6e98e0d2ef /binding/bluetooth-map-bmessage.c | |
parent | d98644e4551f909a3b16c935e64188459b948cc7 (diff) |
Fix potential memory leakneedlefish_13.93.0needlefish/13.93.0marlin_12.93.0marlin_12.92.0marlin_12.91.0marlin_12.90.1marlin_12.90.0marlin/12.93.0marlin/12.92.0marlin/12.91.0marlin/12.90.1marlin/12.90.0lamprey_11.92.0lamprey_11.91.0lamprey/11.92.0lamprey/11.91.013.93.012.93.012.92.012.91.012.90.112.90.011.92.011.91.0
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-bmessage.c')
-rw-r--r-- | binding/bluetooth-map-bmessage.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/binding/bluetooth-map-bmessage.c b/binding/bluetooth-map-bmessage.c index f98d6de..c893649 100644 --- a/binding/bluetooth-map-bmessage.c +++ b/binding/bluetooth-map-bmessage.c @@ -197,7 +197,7 @@ static void sanitize_msg(gchar **msg) json_object *bmessage_parse(const gchar *bmessage) { gchar **msg; - json_object *jresp = json_object_new_object(); + json_object *jresp; gboolean ret; if (!bmessage || !strlen(bmessage)) @@ -208,6 +208,7 @@ json_object *bmessage_parse(const gchar *bmessage) msg = g_strsplit(bmessage, "\n", -1); sanitize_msg(msg); + jresp = json_object_new_object(); ret = __bmessage_parse(msg, jresp); if (!ret) { json_object_put(jresp); |