Subject: Re: Memory leak...

Re: Memory leak...

From: Steinar H. Gunderson <sesse_at_google.com>
Date: Sat, 29 Sep 2007 23:57:13 +0200

On Sat, Sep 29, 2007 at 11:23:42PM +0200, Daniel Stenberg wrote:
> #1 - A fresh new memory leak, much clearly shown by curl's test case 20:
>
> ** MEMORY FAILURE
> Leak detected: memory still allocated: 55 bytes
> At 80f9534, there's 27 bytes.
> allocated by ares_gethostbyname.c:100
> At 80f9504, there's 28 bytes.
> allocated by ares_gethostbyname.c:93

These are probably tricky. I know that the new circular list stuff tends to
confuse some heap checkers, but it's probably a real bug. I'll look into it.

> #2 - ares_process.c:572: warning: implicit declaration of function 'assert'
> http://curl.haxx.se/auto/log.cgi?id=20070929205122-10152#prob5

Fixed now.

> #3 - ares_mkquery.c:125: error: 'MAXCDNAME' undeclared (first use in this
> function)
> http://curl.haxx.se/auto/log.cgi?id=20070929205122-10152#prob6

Hm, is this Windows-specific? It's supposed to be defined in arpa/nameser.h.
I see nameser.h has a #define MAXHOSTNAMELEN 256, though; perhaps it can be
used.

> #4 - ares_gethostbyname.c:218: warning: array subscript has type 'char'
> http://curl.haxx.se/auto/log.cgi?id=20070929172052-10583#prob11

Line 218 reads:

          if (!isdigit(*p) && *p != '.') {

I guess it triggers on the isdigit() part -- that feels really silly...

I do notice that c-ares has macros to work around this issue, though, so I've
changed to using ISDIGIT.

/* Steinar */

-- 
Software Engineer, Google Norway
Received on 2007-09-29