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-02 20:13:05 -0800 |
commit | c2686401edc8a84dcd05eb5e0d3e05354fbf6ced (patch) | |
tree | a6e5996dbb01917ec5c1a711190d965aa7328468 /binding/navigation-api.c | |
parent | 0dc48b9c78aea05f5215f3e31c8af4cf2580523c (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.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) |