Please free strings *after* printing them ;-)
[collectd.git] / src / common.c
index c41c4fe..9c4e64f 100644 (file)
@@ -1020,9 +1020,9 @@ int parse_value (const char *value_orig, value_t *ret_value, int ds_type)
   }
 
   if (value == endptr) {
-    sfree (value);
     ERROR ("parse_value: Failed to parse string as %s: %s.",
         DS_TYPE_TO_STRING (ds_type), value);
+    sfree (value);
     return -1;
   }
   else if ((NULL != endptr) && ('\0' != *endptr))