summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-05-24 17:20:45 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-05-24 17:20:45 +0200
commit2d567b0a2f5251d8808088065085e3173022489f (patch)
treee9079d413176c9c2a6c229f22af356e1f97831d6
parentece754d98ecf9f5b81f5a6e002ee7ea2289a75bb (diff)
avoid to free the same pointer
Change-Id: I0cf860c42046dd3819416688db24a2cd51c3f3aa Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/session.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/session.c b/src/session.c
index e847a6d5..16dc8369 100644
--- a/src/session.c
+++ b/src/session.c
@@ -463,6 +463,6 @@ void ctxClientValueSet(struct AFB_clientCtx *clientCtx, int index, void *value,
assert(index < sessions.apicount);
prev = clientCtx->values[index];
clientCtx->values[index] = (struct client_value){.value = value, .free_value = free_value};
- if (prev.value != NULL && prev.free_value != NULL)
+ if (prev.value != NULL && prev.value != value && prev.free_value != NULL)
prev.free_value(prev.value);
}