diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-12-02 19:43:44 -0800 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-12-03 04:20:37 +0000 |
commit | 2d9012ea413e3bce98f4f616a875a1a21cccbb81 (patch) | |
tree | a6e5996dbb01917ec5c1a711190d965aa7328468 | |
parent | c47a5cec9bd150890b57838f8842130d700ae262 (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>
-rw-r--r-- | binding/navigation-api.c | 10 |
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) |