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
38
lib/share.c
38
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:
|
case CURL_LOCK_DATA_COOKIE:
|
||||||
if (!share->cookies) {
|
if (!share->cookies) {
|
||||||
share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE );
|
share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE );
|
||||||
}
|
if(!share->cookies)
|
||||||
break;
|
return CURLSHE_NOMEM;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case CURL_LOCK_DATA_SSL_SESSION:
|
case CURL_LOCK_DATA_SSL_SESSION: /* not supported (yet) */
|
||||||
break;
|
case CURL_LOCK_DATA_CONNECT: /* not supported (yet) */
|
||||||
|
|
||||||
case CURL_LOCK_DATA_CONNECT:
|
default:
|
||||||
break;
|
return CURLSHE_BAD_OPTION;
|
||||||
|
|
||||||
default:
|
|
||||||
return CURLSHE_BAD_OPTION;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user