curl_json, curl_xml: Fix unitialized variable
[collectd.git] / src / curl_json.c
index 511863e..6c7cf8d 100644 (file)
@@ -859,17 +859,17 @@ static int cj_curl_perform(cj_t *db) /* {{{ */
   int status;
   long rc;
   char *url;
-  url = NULL;
-  curl_easy_getinfo(db->curl, CURLINFO_EFFECTIVE_URL, &url);
+  url = db->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, db->curl_errbuf, (url != NULL) ? url : "<null>");
+           status, db->curl_errbuf, url);
     return (-1);
   }
 
+  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. */