curl-library
Re: [PATCH] fix memory leak in lib/easy
Date: Wed, 4 Mar 2009 21:08:16 -0700
On Wed, Mar 04, 2009 at 06:56:32PM +0100, Kamil Dudka wrote:
> there is a possible (and highly propable) memory leak in lib/easy module.
> If curl_easy_init() is called before curl_global_init(), the 'initialized'
> global variable is incremented and therefor never becomes zero.
>
> In the consequence when running curl binary, the curl_global_cleanup()
> function is not called at all. This causes significant memory leak when using
> nss.
curl_global_init() must be called by curl_easy_init() (if it wasn't already),
but curl_global_cleanup must not be called by curl_easy_cleanup() under
any circumstances. There could be many easy handles still active at the
time curl_easy_cleanup() is called and calling curl_global_cleanup would
close them all. curl_global_cleanup must only be called when the app
has completely finished all use of libcurl, and there's no other way
for libcurl itself to know when that has happened, even when all easy
handled have themselves been closed.
>>> Dan
-- http://www.MoveAnnouncer.com The web change of address service Let webmasters know that your web site has movedReceived on 2009-03-05