libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: plug libltdl memory leak with deplibs


From: Eric Blake
Subject: Re: plug libltdl memory leak with deplibs
Date: Fri, 06 Oct 2006 08:57:31 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Ralf,

According to Ralf Wildenhues on 10/6/2006 7:58 AM:
> Hello Eric,
> 
> * Eric Blake wrote on Tue, Oct 03, 2006 at 01:55:20PM CEST:
>> I noticed this while debugging a memory leak in m4.  This is against head,
>> but if it is approved, I imagine it needs to be backported to the branch
>> as well.  OK to apply?
> 
> The first hunk looks good, I'm not so sure about the second.
> Which system do you see this on, and how do you track memleaks down
> there?

I found this on cygwin, by using the Windows Task Manager to track heap
usage as I repeatedly loaded and unloaded a dlpreopen'd module.  Since the
heap usage kept growing, there was a leak; from there, I opened a
debugger, and noticed that in unload_deplibs, *cur included references to
heap locations.

>> @@ -855,7 +855,7 @@ load_deplibs (lt_dlhandle handle, char *
>>  
>>        cur->deplibs = (lt_dlhandle *) MALLOC (lt__handle, depcount);

This hunk of load_deplibs MALLOCS deplibs,...

>>        if (!cur->deplibs)
>> -    goto cleanup;
>> +    goto cleanup_names;
>>  
>>        for (i = 0; i < depcount; ++i)
>>      {
>> @@ -903,6 +903,7 @@ unload_deplibs (lt_dlhandle handle)
>>            errors += lt_dlclose (cur->deplibs[i]);
>>          }
>>      }
>> +      FREE (cur->deplibs);

...so it's only fair for the unload counterpart to free it.  I stand by
both hunks of the patch.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFJm7b84KuGfSFAYARAmzpAJ9zw+55kcZ6wKBbpPVS+t7qsu9XSgCeNYiF
4dm3iX4ElJjf0cq9ZpRJh/I=
=2xtV
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]