The variable url is used unintialized here. The code used to be the same
in both plugins, but diverged in
19808b44. The solution applied there
does not work correctly as the effective URL can only be queried after
performing the request. Instead, just use the original request URL.
Signed-off-by: Florian Forster <octo@collectd.org>
int status;
long rc;
char *url;
int status;
long rc;
char *url;
- url = NULL;
- curl_easy_getinfo(db->curl, CURLINFO_EFFECTIVE_URL, &url);
status = curl_easy_perform (db->curl);
if (status != CURLE_OK)
{
ERROR ("curl_json plugin: curl_easy_perform failed with status %i: %s (%s)",
status = curl_easy_perform (db->curl);
if (status != CURLE_OK)
{
ERROR ("curl_json plugin: curl_easy_perform failed with status %i: %s (%s)",
- status, db->curl_errbuf, (url != NULL) ? url : "<null>");
+ status, db->curl_errbuf, url);
+ curl_easy_getinfo(db->curl, CURLINFO_EFFECTIVE_URL, &url);
curl_easy_getinfo(db->curl, CURLINFO_RESPONSE_CODE, &rc);
/* The response code is zero if a non-HTTP transport was used. */
curl_easy_getinfo(db->curl, CURLINFO_RESPONSE_CODE, &rc);
/* The response code is zero if a non-HTTP transport was used. */
long rc;
char *ptr;
char *url;
long rc;
char *ptr;
char *url;
db->buffer_fill = 0;
status = curl_easy_perform (curl);
db->buffer_fill = 0;
status = curl_easy_perform (curl);