Handle case where configured curl handle cache limit is 0

svn path=/trunk/netsurf/; revision=12420
This commit is contained in:
John Mark Bell 2011-05-16 22:05:47 +00:00
parent 1b8ff87c23
commit 54f6b3bffc

View File

@ -497,12 +497,18 @@ void fetch_curl_cache_handle(CURL *handle, char *host)
* memory (except the hostname) and without removing the entry from the * memory (except the hostname) and without removing the entry from the
* ring and then re-inserting it, in order to be as efficient as we can. * ring and then re-inserting it, in order to be as efficient as we can.
*/ */
if (curl_handle_ring != NULL) {
h = curl_handle_ring; h = curl_handle_ring;
curl_handle_ring = h->r_next; curl_handle_ring = h->r_next;
curl_easy_cleanup(h->handle); curl_easy_cleanup(h->handle);
h->handle = handle; h->handle = handle;
free(h->host); free(h->host);
h->host = strdup(host); h->host = strdup(host);
} else {
/* Actually, we don't want to cache any handles */
curl_easy_cleanup(handle);
}
return; return;
} }
/* The table isn't full yet, so make a shiny new handle to add to the ring */ /* The table isn't full yet, so make a shiny new handle to add to the ring */