summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7261c01)
raw | patch | inline | side by side (parent: 7261c01)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 18 Apr 2014 12:50:11 +0000 (14:50 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 18 Apr 2014 12:50:11 +0000 (14:50 +0200) |
… and release it when removing it from the TSD. While this shouldn't matter
when everything is done right, this ensures that memory management is done
right.
when everything is done right, this ensures that memory management is done
right.
src/core/plugin.c | patch | blob | history |
diff --git a/src/core/plugin.c b/src/core/plugin.c
index 18ea82c77fc8475d73dfb9e4a37b8a7a693443fc..e67f814ba24510ae47b2640bddfa17dacea3c76f 100644 (file)
--- a/src/core/plugin.c
+++ b/src/core/plugin.c
if (! plugin_ctx_key_initialized)
ctx_key_init();
+ sdb_object_ref(SDB_OBJ(ctx));
pthread_setspecific(plugin_ctx_key, ctx);
return ctx;
} /* ctx_create */
ctx_key_init();
old = pthread_getspecific(plugin_ctx_key);
+ if (old)
+ sdb_object_deref(SDB_OBJ(old));
+ if (new)
+ sdb_object_ref(SDB_OBJ(new));
pthread_setspecific(plugin_ctx_key, new);
return old;
} /* ctx_set */