From: Ruben Kerkhof Date: Sat, 5 Dec 2015 13:03:58 +0000 (+0100) Subject: curl_xml plugin: plug a few leaks on error X-Git-Tag: collectd-5.5.1~25^2~3 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=a2c425d3a1669c6baf06ba27ce2008122fb0ed16;p=collectd.git curl_xml plugin: plug a few leaks on error CID #37993 Signed-off-by: Florian Forster --- diff --git a/src/curl_xml.c b/src/curl_xml.c index 3b153964..f0a1319f 100644 --- a/src/curl_xml.c +++ b/src/curl_xml.c @@ -696,7 +696,7 @@ static int cx_config_add_values (const char *name, cx_xpath_t *xpath, /* {{{ */ sstrncpy (xpath->values[i].path, ci->values[i].value.string, sizeof (xpath->values[i].path)); } - return (0); + return (0); } /* }}} cx_config_add_values */ static int cx_config_add_xpath (cx_t *db, /* {{{ */ @@ -726,6 +726,7 @@ static int cx_config_add_xpath (cx_t *db, /* {{{ */ { ERROR ("curl_xml plugin: invalid xpath. " "xpath value can't be an empty string"); + sfree (xpath); return (-1); } @@ -769,6 +770,8 @@ static int cx_config_add_xpath (cx_t *db, /* {{{ */ if (db->list == NULL) { ERROR ("curl_xml plugin: list creation failed."); + sfree (xpath->path); + sfree (xpath); return (-1); } } @@ -777,6 +780,8 @@ static int cx_config_add_xpath (cx_t *db, /* {{{ */ if (name == NULL) { ERROR ("curl_xml plugin: strdup failed."); + sfree (xpath->path); + sfree (xpath); return (-1); } @@ -784,6 +789,8 @@ static int cx_config_add_xpath (cx_t *db, /* {{{ */ if (le == NULL) { ERROR ("curl_xml plugin: llentry_create failed."); + sfree (xpath->path); + sfree (xpath); return (-1); }