Code

core: Don't leak memory when shutting down the collector loop.
authorSebastian Harl <sh@tokkee.org>
Fri, 25 Apr 2014 14:09:15 +0000 (16:09 +0200)
committerSebastian Harl <sh@tokkee.org>
Fri, 25 Apr 2014 14:09:15 +0000 (16:09 +0200)
Instead, put the current collector object back into the list in oder to keep a
reference to it.

src/core/plugin.c

index d1f7541a3b61824b66eecb27c6f2d29fcc3c233b..dc3717b3dcdf468a290b2b4d2e7214397fb017b2 100644 (file)
@@ -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);