cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Proposed fix for OpenSSL memory leaks.

From: JonathonS <thejunkjon_at_gmail.com>
Date: Thu, 10 May 2012 06:34:44 -0700

Thanks guys for the feedback. It's very informative. So the problem
I am having then is that I am deploying my code to customers as a
dynamic library (DLL on windows, SO on linux). When my library is
unloaded, I invoke the global cleanup function for curl. My customers
can potentially continuously load/unload my library which means that
the global init and global cleanup functions will be invoked several
times -- one for each load and unload. Each time my library is being
unloaded, my debugger reports a memory leak of 36 bytes. I am
assuming this is caused by the "global table" in OpenSSL.

Has anyone encountered this problem? Is this really a memory leak in
OpenSSL or is the debugger confused? If so, what is the suggested
approach for fixing this?

thanks!

J

On Thu, May 10, 2012 at 4:10 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Thu, 10 May 2012, Mischa Salle wrote:
>
>> The real problem emerges if you use both curl+openssl *and* openssl
>> directly, then you can just hope that the cleanup functions put the pointers
>> to NULL to prevent double free()'s...
>
>
> I believe this is generally safe with modern OpenSSL versions.
>
>
>> Concerning the init: in principle the curl_global_init is called
>> automatically by the curl_easy_init if you don't do it explicitly (if I'm
>> not mistaken).
>
>
> That is correct. But as curl_global_init() isn't thread safe etc, letting
> your program depend on the "automatic" init might not be the wisest idea.
>
>
> --
>
>  / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette:  http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-05-10