aboutsummaryrefslogtreecommitdiffstats
path: root/binding/afm-geoclue-binding.c
diff options
context:
space:
mode:
authorLi Xiaoming <lixm.fnst@cn.fujitsu.com>2021-02-18 14:57:13 +0800
committerLi Xiaoming <lixm.fnst@cn.fujitsu.com>2021-02-18 14:57:13 +0800
commitf52bb3484e1000001569a86184e5ece1835c8af6 (patch)
treec1d841b68926a00be5eac207b856c9b7edc3beda /binding/afm-geoclue-binding.c
parenta097eba730c5d30fb4e8ae62b02ac6d4e4b50556 (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: 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.c5
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);