From: Ruben Kerkhof Date: Tue, 30 Jun 2015 12:13:24 +0000 (+0200) Subject: Don't access freed memory X-Git-Tag: collectd-5.5.1~65 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=34d88dda42c1297567f34f334156786ba9a28898;p=collectd.git Don't access freed memory The fields array contains pointers into the value_copy string. --- diff --git a/src/virt.c b/src/virt.c index 69a46071..663555b9 100644 --- a/src/virt.c +++ b/src/virt.c @@ -417,8 +417,8 @@ lv_config (const char *key, const char *value) else if (strcasecmp (fields[i], "uuid") == 0) hostname_format[i] = hf_uuid; else { - sfree (value_copy); ERROR (PLUGIN_NAME " plugin: unknown HostnameFormat field: %s", fields[i]); + sfree (value_copy); return -1; } } @@ -454,8 +454,8 @@ lv_config (const char *key, const char *value) else if (strcasecmp (fields[i], "uuid") == 0) plugin_instance_format[i] = plginst_uuid; else { - sfree (value_copy); ERROR (PLUGIN_NAME " plugin: unknown PluginInstanceFormat field: %s", fields[i]); + sfree (value_copy); return -1; } }