]> granicus.if.org Git - curl/commitdiff
Curl_conncache_add_conn: fix memory leak on OOM
authorDaniel Stenberg <daniel@haxx.se>
Thu, 14 May 2015 12:06:44 +0000 (14:06 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 14 May 2015 12:06:44 +0000 (14:06 +0200)
lib/conncache.c

index 68d9c44df38301909694342d8bc5ce7cac08ead1..5496f097c4f69512c0c7658b15eec1118fcdb558 100644 (file)
@@ -205,8 +205,10 @@ CURLcode Curl_conncache_add_conn(struct conncache *connc,
       return result;
 
     key = hashkey(conn);
-    if(!key)
+    if(!key) {
+      bundle_destroy(new_bundle);
       return CURLE_OUT_OF_MEMORY;
+    }
 
     rc = conncache_add_bundle(data->state.conn_cache, key, new_bundle);
     free(key);