diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2011-05-16 22:05:47 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2011-05-16 22:05:47 +0000 |
commit | 54f6b3bffc05973093a6427c26315608649d303e (patch) | |
tree | 30cf8a6211a6d4c8335cfb1824bbd4a6d0997b69 | |
parent | 1b8ff87c2386f55aa7d02fbb381acabbc93fa63f (diff) | |
download | netsurf-54f6b3bffc05973093a6427c26315608649d303e.tar.gz netsurf-54f6b3bffc05973093a6427c26315608649d303e.tar.bz2 |
Handle case where configured curl handle cache limit is 0
svn path=/trunk/netsurf/; revision=12420
-rw-r--r-- | content/fetchers/curl.c | 18 |
1 files 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 */ |