From: Florian Forster Date: Mon, 11 Jan 2010 14:46:30 +0000 (+0100) Subject: curl_xml plugin: Make absolutely certain “instance_node_obj” is freed. X-Git-Tag: collectd-4.10.0~72^2~8 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e7c4bd42a615b65882e26064081734d4c0e9f988;p=collectd.git curl_xml plugin: Make absolutely certain “instance_node_obj” is freed. --- diff --git a/src/curl_xml.c b/src/curl_xml.c index 78051667..5fd3f59a 100644 --- a/src/curl_xml.c +++ b/src/curl_xml.c @@ -299,6 +299,7 @@ static int cx_submit_xpath_values (char *plugin_instance, /* {{{ */ /* instance has to be an xpath expression */ if (xpath->instance != NULL) { + assert (instance_node_obj == NULL); instance_node_obj = cx_evaluate_xpath (xpath_ctx, BAD_CAST xpath->instance); if (instance_node_obj == NULL) continue; /* error is logged already */ @@ -438,8 +439,11 @@ static int cx_submit_xpath_values (char *plugin_instance, /* {{{ */ sfree(vl.values); if (instance_node_obj != NULL) + { xmlXPathFreeObject (instance_node_obj); - } + instance_node_obj = NULL; + } + } /* for (i = 0; i < total_nodes; i++) */ /* free up the allocated memory */ xmlXPathFreeObject (base_node_obj);