cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Test patches

From: James Bursa <james_at_semichrome.net>
Date: Tue, 11 May 2004 16:28:41 +0100

A bit more torture testing. Tests 1-8 now have no leaks for me.

Ares calls free(0) at ares_init.c:457 in one malloc failure, so prevent
curl_dofree() asserting:

diff -d -u -3 -w -r1.44 memdebug.c
--- lib/memdebug.c 11 May 2004 11:30:23 -0000 1.44
+++ lib/memdebug.c 11 May 2004 15:21:29 -0000
@@ -215,6 +215,9 @@
 {
   struct memdebug *mem;
 
+ if (!ptr)
+ return;
+
   curlassert(ptr != NULL);
 
   mem = (struct memdebug *)((char *)ptr - offsetof(struct memdebug, mem));
___________________________________________________________________________

Call ares_destroy() on malloc failure in Curl_open():

diff -d -u -3 -w -r1.374 url.c
--- lib/url.c 11 May 2004 11:30:24 -0000 1.374
+++ lib/url.c 11 May 2004 15:21:31 -0000
@@ -282,6 +282,9 @@
 
   data->state.headerbuff=(char*)malloc(HEADERSIZE);
   if(!data->state.headerbuff) {
+#ifdef USE_ARES
+ ares_destroy(data->state.areschannel);
+#endif
     free(data); /* free the memory again */
     return CURLE_OUT_OF_MEMORY;
   }
@@ -328,6 +331,9 @@
     malloc(sizeof(struct connectdata *) * data->state.numconnects);
 
   if(!data->state.connects) {
+#ifdef USE_ARES
+ ares_destroy(data->state.areschannel);
+#endif
     free(data->state.headerbuff);
     free(data);
     return CURLE_OUT_OF_MEMORY;
Received on 2004-05-11