From 19808b4489b7e096fe4b53446f33d917f0e16438 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 3 Jan 2011 17:41:33 +0100 Subject: [PATCH] curl_json plugin: Query the URL before trying to print it. This resolved a segmentation fault. --- src/curl_json.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/curl_json.c b/src/curl_json.c index 442cfcf9..06119f1d 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -705,17 +705,19 @@ static int cj_curl_perform (cj_t *db, CURL *curl) /* {{{ */ return (-1); } + url = NULL; + curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url); + status = curl_easy_perform (curl); if (status != 0) { ERROR ("curl_json plugin: curl_easy_perform failed with status %i: %s (%s)", - status, db->curl_errbuf, url); + status, db->curl_errbuf, (url != NULL) ? url : ""); yajl_free (db->yajl); db->yajl = yprev; return (-1); } - curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &rc); /* The response code is zero if a non-HTTP transport was used. */ -- 2.11.0