From: Sebastian Harl Date: Fri, 25 Apr 2014 14:09:15 +0000 (+0200) Subject: core: Don't leak memory when shutting down the collector loop. X-Git-Tag: sysdb-0.1.0~81^2~1 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=923589c5a145693bfd172fd9b211a50c3ab8f1b1 core: Don't leak memory when shutting down the collector loop. Instead, put the current collector object back into the list in oder to keep a reference to it. --- diff --git a/src/core/plugin.c b/src/core/plugin.c index d1f7541..dc3717b 100644 --- a/src/core/plugin.c +++ b/src/core/plugin.c @@ -1010,8 +1010,13 @@ sdb_plugin_collector_loop(sdb_plugin_loop_t *loop) errno = 0; } - if (! loop->do_loop) + if (! loop->do_loop) { + /* put back; don't worry about errors */ + sdb_llist_insert_sorted(collector_list, obj, + plugin_cmp_next_update); + sdb_object_deref(obj); return 0; + } } old_ctx = ctx_set(SDB_PLUGIN_CCB(obj)->ccb_ctx);