Skip to content
Snippets Groups Projects
Commit 0119cb4f authored by Matt Ranostay's avatar Matt Ranostay
Browse files

binding: navigation: move get_storage_from_value call within write lock


json_object returned from get_storage_from_value() needs to be protected
within the write lock. This is to prevent reentrant calls to broadcast() from
accessing it, and running json_object_put()

Bug-AGL: SPEC-2880
Change-Id: I9fdf614728368c75e925e4c5a0f3ca19a7e517e1
Signed-off-by: default avatarMatt Ranostay <matt.ranostay@konsulko.com>
parent 2d9012ea
No related branches found
No related tags found
No related merge requests found
...@@ -135,10 +135,12 @@ static void broadcast(afb_req_t request, const char *name, gboolean cache) ...@@ -135,10 +135,12 @@ static void broadcast(afb_req_t request, const char *name, gboolean cache)
json_object *jresp = afb_req_json(request); json_object *jresp = afb_req_json(request);
if (cache) { if (cache) {
json_object **storage = get_storage_from_value(ns, name); json_object **storage;
g_rw_lock_writer_lock(&ns->rw_lock); g_rw_lock_writer_lock(&ns->rw_lock);
storage = get_storage_from_value(ns, name);
if (*storage) if (*storage)
json_object_put(*storage); json_object_put(*storage);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment