utils_cache: Free then unused memory before returning in an error condition.
[collectd.git] / src / utils_cache.c
index 6779bba..7938412 100644 (file)
@@ -187,6 +187,7 @@ static int uc_insert (const data_set_t *ds, const value_list_t *vl,
   ce = cache_alloc (ds->ds_num);
   if (ce == NULL)
   {
+    sfree (key_copy);
     ERROR ("uc_insert: cache_alloc (%i) failed.", ds->ds_num);
     return (-1);
   }