Fixed possible memory leak in case of broken match_value configs.
authorSven Trenkel <collectd@semidefinite.de>
Thu, 30 Sep 2010 10:59:21 +0000 (12:59 +0200)
committerSven Trenkel <collectd@semidefinite.de>
Thu, 30 Sep 2010 10:59:21 +0000 (12:59 +0200)
src/match_value.c

index 9f02226..ae6282c 100644 (file)
@@ -53,9 +53,18 @@ struct mv_match_s
  */
 static void mv_free_match (mv_match_t *m) /* {{{ */
 {
+  int i;
+  
   if (m == NULL)
     return;
 
+  if (m->data_sources != NULL)
+  {
+    for (i = 0; i < m->data_sources_num; ++i)
+      free(m->data_sources[i]);
+    free(m->data_sources);
+  }
+  
   free (m);
 } /* }}} void mv_free_match */