Address more review comments:
[collectd.git] / src / target_set.c
index 95f0317..3de86e4 100644 (file)
@@ -43,12 +43,12 @@ static void ts_key_list_free (ts_key_list_t *l) /* {{{ */
   if (l == NULL)
     return;
 
-  free (l->key);
+  sfree (l->key);
 
   if (l->next != NULL)
     ts_key_list_free (l->next);
 
-  free (l);
+  sfree (l);
 } /* }}} void ts_name_list_free */
 
 struct ts_data_s
@@ -153,13 +153,16 @@ static int ts_config_add_meta_delete (ts_key_list_t **dest, /* {{{ */
   }
 
   if (cf_util_get_string (ci, &entry->key) != 0)
+  {
+    ts_key_list_free (entry);
     return (-1);  /* An error has already been reported. */
+  }
 
   if (strlen (entry->key) == 0)
   {
     ERROR ("Target `set': The `%s' option does not accept empty string as "
         "first argument.", ci->key);
-    sfree (entry->key);
+    ts_key_list_free (entry);
     return (-1);
   }