summaryrefslogtreecommitdiffstats
path: root/binding/navigation-api.c
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-12-02 19:43:44 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2019-12-03 04:20:37 +0000
commit2d9012ea413e3bce98f4f616a875a1a21cccbb81 (patch)
treea6e5996dbb01917ec5c1a711190d965aa7328468 /binding/navigation-api.c
parentc47a5cec9bd150890b57838f8842130d700ae262 (diff)
binding: navigation: add missing read lock around afb_event_push()
Add missing read lock around event pushing from value that isn't required to be cached. Bug-AGL: SPEC-2880 Change-Id: I7aae2ec9df722fdefcec2d35977251e008375d92 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/navigation-api.c')
-rw-r--r--binding/navigation-api.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/binding/navigation-api.c b/binding/navigation-api.c
index d9ea285..19913a1 100644
--- a/binding/navigation-api.c
+++ b/binding/navigation-api.c
@@ -146,12 +146,22 @@ static void broadcast(afb_req_t request, const char *name, gboolean cache)
json_object_get(jresp);
*storage = jresp;
+ // increment reference for event
+ json_object_get(jresp);
+ afb_event_push(event, jresp);
+
g_rw_lock_writer_unlock(&ns->rw_lock);
+
+ return;
}
+ g_rw_lock_reader_lock(&ns->rw_lock);
+
// increment reference for event
json_object_get(jresp);
afb_event_push(event, jresp);
+
+ g_rw_lock_reader_unlock(&ns->rw_lock);
}
static void broadcast_status(afb_req_t request)