summaryrefslogtreecommitdiff
path: root/lib/share.c
diff options
context:
space:
mode:
authorseonah moon <seonah1.moon@samsung.com>2016-04-11 04:05:33 -0700
committerseonah moon <seonah1.moon@samsung.com>2016-04-11 04:05:33 -0700
commit7b6dca47a42828c0ae87eab0d8b68f97d1495b67 (patch)
tree10a20bd420864ba529d87794b27ebf303ae7c86a /lib/share.c
parent8a08705db260779441360e959b97b6c172f8acb0 (diff)
downloadcurl-7b6dca47a42828c0ae87eab0d8b68f97d1495b67.tar.gz
curl-7b6dca47a42828c0ae87eab0d8b68f97d1495b67.tar.bz2
curl-7b6dca47a42828c0ae87eab0d8b68f97d1495b67.zip
Revert "Imported Upstream version 7.44.0"
This reverts commit 8a08705db260779441360e959b97b6c172f8acb0. Change-Id: Ie319aab9015869b714a03b8aa890a67ccbc9233e
Diffstat (limited to 'lib/share.c')
-rw-r--r--lib/share.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/share.c b/lib/share.c
index 17202486c..b8b6bee80 100644
--- a/lib/share.c
+++ b/lib/share.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -35,15 +35,9 @@ CURLSH *
curl_share_init(void)
{
struct Curl_share *share = calloc(1, sizeof(struct Curl_share));
- if(share) {
+ if(share)
share->specifier |= (1<<CURL_LOCK_DATA_SHARE);
- if(Curl_mk_dnscache(&share->hostcache)) {
- free(share);
- return NULL;
- }
- }
-
return share;
}
@@ -73,6 +67,11 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
share->specifier |= (1<<type);
switch( type ) {
case CURL_LOCK_DATA_DNS:
+ if(!share->hostcache) {
+ share->hostcache = Curl_mk_dnscache();
+ if(!share->hostcache)
+ res = CURLSHE_NOMEM;
+ }
break;
case CURL_LOCK_DATA_COOKIE:
@@ -116,6 +115,10 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
share->specifier &= ~(1<<type);
switch( type ) {
case CURL_LOCK_DATA_DNS:
+ if(share->hostcache) {
+ Curl_hash_destroy(share->hostcache);
+ share->hostcache = NULL;
+ }
break;
case CURL_LOCK_DATA_COOKIE:
@@ -189,10 +192,14 @@ curl_share_cleanup(CURLSH *sh)
return CURLSHE_IN_USE;
}
- Curl_hash_destroy(&share->hostcache);
+ if(share->hostcache) {
+ Curl_hash_destroy(share->hostcache);
+ share->hostcache = NULL;
+ }
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
- Curl_cookie_cleanup(share->cookies);
+ if(share->cookies)
+ Curl_cookie_cleanup(share->cookies);
#endif
#ifdef USE_SSL