1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

share_init: fix OOM crash

A failed calloc() would lead to NULL pointer use.

Coverity CID 1299427.
This commit is contained in:
Daniel Stenberg 2015-05-22 16:26:14 +02:00
parent 817323ed82
commit 03e2a9b023

View File

@ -35,13 +35,14 @@ 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;
}