From 03e2a9b023f60c2190c2b8590f16b2a4f83f21a9 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 22 May 2015 16:26:14 +0200 Subject: share_init: fix OOM crash A failed calloc() would lead to NULL pointer use. Coverity CID 1299427. --- lib/share.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/share.c b/lib/share.c index 7fb068625..17202486c 100644 --- a/lib/share.c +++ b/lib/share.c @@ -35,12 +35,13 @@ CURLSH * curl_share_init(void) { struct Curl_share *share = calloc(1, sizeof(struct Curl_share)); - if(share) + if(share) { share->specifier |= (1<hostcache)) { - free(share); - return NULL; + if(Curl_mk_dnscache(&share->hostcache)) { + free(share); + return NULL; + } } return share; -- cgit v1.2.3