avoid to free the same pointer
authorJosé Bollo <jose.bollo@iot.bzh>
Tue, 24 May 2016 15:20:45 +0000 (17:20 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Tue, 24 May 2016 15:20:45 +0000 (17:20 +0200)
Change-Id: I0cf860c42046dd3819416688db24a2cd51c3f3aa
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/session.c

index e847a6d..16dc836 100644 (file)
@@ -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);
 }