hash: lazy-alloc the table in Curl_hash_add()

This makes Curl_hash_init() infallible which saves error paths.

Closes #8132
This commit is contained in:
Daniel Stenberg 2021-12-10 12:54:17 +01:00
parent e43ad4b474
commit 254f7bd78a
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
10 changed files with 78 additions and 83 deletions

View file

@ -39,11 +39,7 @@ curl_share_init(void)
if(share) {
share->magic = CURL_GOOD_SHARE;
share->specifier |= (1<<CURL_LOCK_DATA_SHARE);
if(Curl_mk_dnscache(&share->hostcache)) {
free(share);
return NULL;
}
Curl_init_dnscache(&share->hostcache);
}
return share;