curl-library
Re: Test patches
Date: Wed, 12 May 2004 13:16:08 +0100
On Tuesday 11 May 2004 22:21, Daniel Stenberg wrote:
> James, I can't manage to get a free(NULL) in ares when I run runtests.pl -t
> [num] on the first 8 tests with my ares-enabled curl? Can you figure out a
> fix for this in the c-ares side instead?
diff -d -u -3 -w -r1.11 ares_init.c
--- ares_init.c	11 May 2004 21:12:10 -0000	1.11
+++ ares_init.c	12 May 2004 12:07:57 -0000
@@ -101,13 +101,13 @@
       /* Something failed; clean up memory we may have allocated. */
       if (channel->nservers != -1)
         free(channel->servers);
-      if (channel->ndomains != -1)
+      if (channel->domains && channel->ndomains != -1)
         {
           for (i = 0; i < channel->ndomains; i++)
             free(channel->domains[i]);
           free(channel->domains);
         }
-      if (channel->nsort != -1)
+      if (channel->sortlist && channel->nsort != -1)
         free(channel->sortlist);
       if(channel->lookups)
         free(channel->lookups);
@@ -454,7 +454,8 @@
       if (status != ARES_SUCCESS)
         break;
     }
-    free(line);
+    if (line)
+      free(line);
     fclose(fp);
   }
  
James
Received on 2004-05-12