X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fbind.c;h=fc1fd92f0385905638e2f750d882b930cdc55b10;hb=e7a7be6760b7f79780e9e9ed10fa9e029a3faa38;hp=4860f1b6045667bcfebbb264ffb9ff2100e9ddc1;hpb=c3e2a69bd600fa4c4a9d4603094f39ea81c11116;p=collectd.git diff --git a/src/bind.c b/src/bind.c index 4860f1b6..fc1fd92f 100644 --- a/src/bind.c +++ b/src/bind.c @@ -526,8 +526,10 @@ static int bind_parse_generic_name_value(const char *xpath_expression, /* {{{ */ status = bind_xml_read_gauge(doc, counter, &value.gauge); else status = bind_xml_read_derive(doc, counter, &value.derive); - if (status != 0) + if (status != 0) { + xmlFree(name); continue; + } status = (*list_callback)(name, value, current_time, user_data); if (status == 0) @@ -659,12 +661,16 @@ static int bind_parse_generic_name_attr_value_list( status = bind_xml_read_gauge(doc, child, &value.gauge); else status = bind_xml_read_derive(doc, child, &value.derive); - if (status != 0) + if (status != 0) { + xmlFree(attr_name); continue; + } status = (*list_callback)(attr_name, value, current_time, user_data); if (status == 0) num_entries++; + + xmlFree(attr_name); } } @@ -1596,7 +1602,6 @@ static int bind_init(void) /* {{{ */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, bind_curl_callback); curl_easy_setopt(curl, CURLOPT_USERAGENT, COLLECTD_USERAGENT); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, bind_curl_error); - curl_easy_setopt(curl, CURLOPT_URL, (url != NULL) ? url : BIND_DEFAULT_URL); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L); #ifdef HAVE_CURLOPT_TIMEOUT_MS @@ -1618,6 +1623,9 @@ static int bind_read(void) /* {{{ */ } bind_buffer_fill = 0; + + curl_easy_setopt(curl, CURLOPT_URL, (url != NULL) ? url : BIND_DEFAULT_URL); + if (curl_easy_perform(curl) != CURLE_OK) { ERROR("bind plugin: curl_easy_perform failed: %s", bind_curl_error); return (-1);