cURL / Mailing Lists / curl-library / Single Mail


Re: Mem leak in curl_ntlm_msg.c

From: Gisle Vanem <>
Date: Mon, 11 Feb 2013 13:58:59 +0100

"Christian Hägele" <> wrote:

> I didn't have the opportunity to test the code, but as

Really? You should build libcurl with '-DCURLDEBUG', do a
"set CURL_MEMDEBUG=mem_trace_file", run
tests\libtest\libntlmconnect.exe and check leaks with
"perl tests\ mem_trace_file".

> dup_domain.tbyte_ptr and dup_domain.tchar_ptr is the same pointer (it's defined as union xcharp_u not as struct) your explanation
> seems wrong.
> If you free dup_domain.tchar_ptr as you proposed in your patch you also deleting the memory you just assigned to the
> ntlm->identity.Domain pointer.
> Did I miss something here? Did you test your code with a domainlen larger than 0?

No. But I don't think the leaks dissapears if 'domlen > 0'.

I saw the definition of 'xcharp_u' and '#ifdef's in curl_multibyte.h just now
(the macros for UNICODE vs. ASCII). If you mean my added 'free()' results
in double-freeing, that's not so evident from your NTLM source (which is not
so easy to follow).

The trace from CURL_MEMDEBUG evidently show a mem-leak in the NTLM sources.
Please take a look at it.


List admin:
Received on 2013-02-11