Merge branch 'collectd-5.4' into collectd-5.5
[collectd.git] / src / curl_xml.c
index 37a3686..efaf290 100644 (file)
@@ -698,7 +698,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, /* {{{ */
@@ -728,6 +728,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);
   }
 
@@ -771,6 +772,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);
       }
     }
@@ -779,6 +782,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);
     }
 
@@ -786,6 +791,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);
     }