]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi: free sockhash on OOM
authorDaniel Stenberg <daniel@haxx.se>
Fri, 13 Dec 2019 16:45:21 +0000 (17:45 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 13 Dec 2019 21:46:46 +0000 (22:46 +0100)
This would otherwise leak memory in the error path.

Detected by torture test 1540.

Closes #4713

lib/multi.c

index cc11ea61768ab5d61f13266c9321f73e6ccda94f..6d819b4aaa7bad8505d441eea96be44f0f0ad83f 100755 (executable)
@@ -260,6 +260,7 @@ static struct Curl_sh_entry *sh_addentry(struct curl_hash *sh,
 
   /* make/add new hash entry */
   if(!Curl_hash_add(sh, (char *)&s, sizeof(curl_socket_t), check)) {
+    Curl_hash_destroy(&check->transfers);
     free(check);
     return NULL; /* major failure */
   }