statsd plugin: Correctly free metrics at shutdown.
authorFlorian Forster <octo@collectd.org>
Wed, 25 Nov 2015 10:51:04 +0000 (11:51 +0100)
committerFlorian Forster <octo@collectd.org>
Wed, 25 Nov 2015 10:56:37 +0000 (11:56 +0100)
The previous shutdown handler leaked "timer" and "set" metrics. This is
not a huge problem in itself, as the daemon is exiting shortly after
anyway, but it makes debugging of memory leaks very hard.

Issue: #997

src/statsd.c

index 96c471d..82dbce7 100644 (file)
@@ -948,7 +948,7 @@ static int statsd_shutdown (void) /* {{{ */
   while (c_avl_pick (metrics_tree, &key, &value) == 0)
   {
     sfree (key);
-    sfree (value);
+    statsd_metric_free (value);
   }
   c_avl_destroy (metrics_tree);
   metrics_tree = NULL;