cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Mem leak in curl_ntlm_msg.c

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

"Christian Hägele" <haegele_at_teamviewer.com> 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\memanalyze.pl 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.

--gv

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-02-11