aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-05-22 16:26:14 +0200
committerDaniel Stenberg <daniel@haxx.se>2015-05-22 16:26:14 +0200
commit03e2a9b023f60c2190c2b8590f16b2a4f83f21a9 (patch)
treeaaf719ebd20406dd7ebca18ab08c7861ddd54bea
parent817323ed822ef16d7551315b7a74cf9a6c9e07af (diff)
share_init: fix OOM crash
A failed calloc() would lead to NULL pointer use. Coverity CID 1299427.
-rw-r--r--lib/share.c9
1 files changed, 5 insertions, 4 deletions
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<<CURL_LOCK_DATA_SHARE);
- if(Curl_mk_dnscache(&share->hostcache)) {
- free(share);
- return NULL;
+ if(Curl_mk_dnscache(&share->hostcache)) {
+ free(share);
+ return NULL;
+ }
}
return share;