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, 13 Oct 2006 14:13:10 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

> >> 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?
> 
...
> ...so it's only fair for the unload counterpart to free it.  I stand by
> both hunks of the patch.

No further comments, so I went ahead and committed both hunks.  The following 
is the counterpart I installed in the branch.

2006-10-13  Eric Blake  <address@hidden>

        * libltdl/ltdl.c (unload_deplibs, load_deplibs): Avoid memory
        leaks.

Index: libltdl/ltdl.c
===================================================================
RCS file: /sources/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.174.2.22
diff -u -r1.174.2.22 ltdl.c
--- libltdl/ltdl.c      11 Jan 2006 17:25:31 -0000      1.174.2.22
+++ libltdl/ltdl.c      13 Oct 2006 14:12:10 -0000
@@ -2944,7 +2944,7 @@
 
       handle->deplibs = (lt_dlhandle*) LT_EMALLOC (lt_dlhandle *, depcount);
       if (!handle->deplibs)
-       goto cleanup;
+       goto cleanup_names;
 
       for (i = 0; i < depcount; ++i)
        {
@@ -2995,6 +2995,7 @@
              errors += lt_dlclose (handle->deplibs[i]);
            }
        }
+      LT_DLFREE (handle->deplibs);
     }
 
   return errors;






reply via email to

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