]> granicus.if.org Git - curl/commitdiff
hostip.c: fix Curl_loadhostpairs() OOM handling
authorYang Tse <yangsita@gmail.com>
Mon, 2 Jan 2012 12:41:09 +0000 (13:41 +0100)
committerYang Tse <yangsita@gmail.com>
Mon, 2 Jan 2012 12:41:09 +0000 (13:41 +0100)
lib/hostip.c

index 0d737f4060556a59e1951c58d08d91e15169f789..828d27e42b79f3df5bb3af9eb769534e26c26448 100644 (file)
@@ -782,8 +782,10 @@ CURLcode Curl_loadhostpairs(struct SessionHandle *data)
       /* Create an entry id, based upon the hostname and port */
       entry_id = create_hostcache_id(hostname, port);
       /* If we can't create the entry id, fail */
-      if(!entry_id)
+      if(!entry_id) {
+        Curl_freeaddrinfo(addr);
         return CURLE_OUT_OF_MEMORY;
+      }
 
       entry_len = strlen(entry_id);