[prev in list] [next in list] [prev in thread] [next in thread] 

List:       curl-commits
Subject:    cvs: curl /lib hostip.c
From:       "Daniel Stenberg" <bagder () php ! net>
Date:       2003-12-15 15:22:11
[Download RAW message or body]

bagder		Mon Dec 15 10:22:11 2003 EDT

  Modified files:              
    /curl/lib	hostip.c 
  Log:
  if Curl_hash_add() returns NULL, we shall not free the addrinfo field as that
  is made in the hash function in the case of failure (using the already setup
  'dtor' function).
  
  
Index: curl/lib/hostip.c
diff -u curl/lib/hostip.c:1.110 curl/lib/hostip.c:1.111
--- curl/lib/hostip.c:1.110	Wed Dec  3 02:55:52 2003
+++ curl/lib/hostip.c	Mon Dec 15 10:22:10 2003
@@ -18,7 +18,7 @@
  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  * KIND, either express or implied.
  *
- * $Id: hostip.c,v 1.110 2003/12/03 07:55:52 bagder Exp $
+ * $Id: hostip.c,v 1.111 2003/12/15 15:22:10 bagder Exp $
  ***************************************************************************/
 
 #include "setup.h"
@@ -237,10 +237,10 @@
   /* Store the resolved data in our DNS cache. This function may return a
      pointer to an existing struct already present in the hash, and it may
      return the same argument we pass in. Make no assumptions. */
-  dns = Curl_hash_add(data->hostcache, entry_id, entry_len+1, (void *) dns);
+  dns = Curl_hash_add(data->hostcache, entry_id, entry_len+1, (void *)dns);
   if(!dns) {
-    /* major badness, run away! */
-    Curl_freeaddrinfo(addr);
+    /* Major badness, run away. When this happens, the 'dns' data has
+       already been cleared up by Curl_hash_add(). */
     free(entry_id);
     return NULL;
   }




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic