mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
check that memory allocation functions truly return good data or bail out
This commit is contained in:
parent
1c69b15c7c
commit
b6ee33c6e1
40
lib/share.c
40
lib/share.c
@ -68,28 +68,28 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
|
|||||||
/* this is a type this share will share */
|
/* this is a type this share will share */
|
||||||
type = va_arg(param, int);
|
type = va_arg(param, int);
|
||||||
share->specifier |= (1<<type);
|
share->specifier |= (1<<type);
|
||||||
switch( type )
|
switch( type ) {
|
||||||
{
|
case CURL_LOCK_DATA_DNS:
|
||||||
case CURL_LOCK_DATA_DNS:
|
if (!share->hostcache) {
|
||||||
if (!share->hostcache) {
|
share->hostcache = Curl_mk_dnscache();
|
||||||
share->hostcache = Curl_mk_dnscache();
|
if(!share->hostcache)
|
||||||
}
|
return CURLSHE_NOMEM;
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CURL_LOCK_DATA_COOKIE:
|
||||||
|
if (!share->cookies) {
|
||||||
|
share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE );
|
||||||
|
if(!share->cookies)
|
||||||
|
return CURLSHE_NOMEM;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case CURL_LOCK_DATA_COOKIE:
|
case CURL_LOCK_DATA_SSL_SESSION: /* not supported (yet) */
|
||||||
if (!share->cookies) {
|
case CURL_LOCK_DATA_CONNECT: /* not supported (yet) */
|
||||||
share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CURL_LOCK_DATA_SSL_SESSION:
|
default:
|
||||||
break;
|
return CURLSHE_BAD_OPTION;
|
||||||
|
|
||||||
case CURL_LOCK_DATA_CONNECT:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return CURLSHE_BAD_OPTION;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user