diff options
author | Li Xiaoming <lixm.fnst@cn.fujitsu.com> | 2021-02-18 14:57:13 +0800 |
---|---|---|
committer | Li Xiaoming <lixm.fnst@cn.fujitsu.com> | 2021-02-18 14:57:13 +0800 |
commit | f52bb3484e1000001569a86184e5ece1835c8af6 (patch) | |
tree | c1d841b68926a00be5eac207b856c9b7edc3beda /binding/afm-geoclue-binding.c | |
parent | a097eba730c5d30fb4e8ae62b02ac6d4e4b50556 (diff) |
Fix potential memory leakneedlefish_13.93.0needlefish/13.93.0marlin_12.93.0marlin_12.91.0marlin_12.90.1marlin_12.90.0marlin/12.93.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.91.012.90.112.90.011.92.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: I06318f408477df441074b38c4d1e33534820db52
Signed-off-by: Li Xiaoming <lixm.fnst@cn.fujitsu.com>
Diffstat (limited to 'binding/afm-geoclue-binding.c')
-rw-r--r-- | binding/afm-geoclue-binding.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/binding/afm-geoclue-binding.c b/binding/afm-geoclue-binding.c index 07b19e1..7aef809 100644 --- a/binding/afm-geoclue-binding.c +++ b/binding/afm-geoclue-binding.c @@ -101,14 +101,13 @@ static void send_event(GClueSimple *simple) static void get_data(afb_req_t request) { - json_object *jresp = json_object_new_object(); - GClueLocation *location; - if (simple == NULL) { afb_req_fail(request, "failed", "No GeoClue instance available"); return; } + json_object *jresp = json_object_new_object(); + GClueLocation *location; location = gclue_simple_get_location(simple); populate_json(jresp, location); |