]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
James Bursa's patch to avoid free(NULL) (mainly because the libcurl memdebug
authorDaniel Stenberg <daniel@haxx.se>
Thu, 13 May 2004 06:53:29 +0000 (06:53 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 13 May 2004 06:53:29 +0000 (06:53 +0000)
system thinks free(NULL) is badness)

ares/ares_init.c

index 09062ac80ed5de94970ec8257c31f850c7b29936..19c3eb26bd46fb19d00abdc3452d8cdb5ee6249d 100644 (file)
@@ -101,13 +101,13 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
       /* Something failed; clean up memory we may have allocated. */
       if (channel->nservers != -1)
        free(channel->servers);
-      if (channel->ndomains != -1)
+      if (channel->domains)
        {
          for (i = 0; i < channel->ndomains; i++)
            free(channel->domains[i]);
          free(channel->domains);
        }
-      if (channel->nsort != -1)
+      if (channel->sortlist)
        free(channel->sortlist);
       if(channel->lookups)
         free(channel->lookups);
@@ -454,7 +454,8 @@ DhcpNameServer
       if (status != ARES_SUCCESS)
         break;
     }
-    free(line);
+    if(line)
+      free(line);
     fclose(fp);
   }