mirror of
https://github.com/moparisthebest/curl
synced 2025-03-11 07:39:50 -04:00
share_init: fix OOM crash
A failed calloc() would lead to NULL pointer use. Coverity CID 1299427.
This commit is contained in:
parent
817323ed82
commit
03e2a9b023
@ -35,12 +35,13 @@ CURLSH *
|
|||||||
curl_share_init(void)
|
curl_share_init(void)
|
||||||
{
|
{
|
||||||
struct Curl_share *share = calloc(1, sizeof(struct Curl_share));
|
struct Curl_share *share = calloc(1, sizeof(struct Curl_share));
|
||||||
if(share)
|
if(share) {
|
||||||
share->specifier |= (1<<CURL_LOCK_DATA_SHARE);
|
share->specifier |= (1<<CURL_LOCK_DATA_SHARE);
|
||||||
|
|
||||||
if(Curl_mk_dnscache(&share->hostcache)) {
|
if(Curl_mk_dnscache(&share->hostcache)) {
|
||||||
free(share);
|
free(share);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return share;
|
return share;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user