From 54f6b3bffc05973093a6427c26315608649d303e Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 16 May 2011 22:05:47 +0000 Subject: [PATCH] Handle case where configured curl handle cache limit is 0 svn path=/trunk/netsurf/; revision=12420 --- content/fetchers/curl.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c index 09709aca8..8cb869e52 100644 --- a/content/fetchers/curl.c +++ b/content/fetchers/curl.c @@ -497,12 +497,18 @@ void fetch_curl_cache_handle(CURL *handle, char *host) * 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. */ - h = curl_handle_ring; - curl_handle_ring = h->r_next; - curl_easy_cleanup(h->handle); - h->handle = handle; - free(h->host); - h->host = strdup(host); + if (curl_handle_ring != NULL) { + h = curl_handle_ring; + curl_handle_ring = h->r_next; + curl_easy_cleanup(h->handle); + h->handle = handle; + free(h->host); + h->host = strdup(host); + } else { + /* Actually, we don't want to cache any handles */ + curl_easy_cleanup(handle); + } + return; } /* The table isn't full yet, so make a shiny new handle to add to the ring */