summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--binding/navigation-api.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/binding/navigation-api.c b/binding/navigation-api.c
index 19913a1..ab7a5b7 100644
--- a/binding/navigation-api.c
+++ b/binding/navigation-api.c
@@ -135,10 +135,12 @@ static void broadcast(afb_req_t request, const char *name, gboolean cache)
json_object *jresp = afb_req_json(request);
if (cache) {
- json_object **storage = get_storage_from_value(ns, name);
+ json_object **storage;
g_rw_lock_writer_lock(&ns->rw_lock);
+ storage = get_storage_from_value(ns, name);
+
if (*storage)
json_object_put(*storage);