]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/ltdl.c (tryall_dlopen): Rename argument to have typed
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 1 Jul 2007 06:12:46 +0000 (06:12 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 1 Jul 2007 06:12:46 +0000 (06:12 +0000)
alias of `advise' instead of allocating a copy.  Fixes memleak.

ChangeLog
libltdl/ltdl.c

index 0584b9ac7e8c48687e16d3c18c7bda8f1386bde6..e64424fbd18039fdf866a127d7408eb0e5c3a1f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-07-01  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * libltdl/ltdl.c (tryall_dlopen): Rename argument to have typed
+       alias of `advise' instead of allocating a copy.  Fixes memleak.
+
 2007-06-30  Peter Breitenlohner  <peb@mppmu.mpg.de>
 
        * libltdl/m4/libtool.m4 (LT_SYS_DLOPEN_SELF): Correct a typo
index 1f132ca8c852870180726a70a0c40eabf9732368..76a5a782091de58548dc41691fa382636188fa29 100644 (file)
@@ -120,7 +120,7 @@ static      int     try_dlopen            (lt_dlhandle *handle,
                                       lt_dladvise advise);
 static int     tryall_dlopen         (lt_dlhandle *handle,
                                       const char *filename,
-                                      lt_dladvise advise,
+                                      lt_dladvise padvise,
                                       const lt_dlvtable *vtable);
 static int     unload_deplibs        (lt_dlhandle handle);
 static lt__advise *advise_dup        (lt__advise *advise);
@@ -342,11 +342,12 @@ lt_dlexit (void)
    the dlhandle is stored at the address given in PHANDLE.  */
 static int
 tryall_dlopen (lt_dlhandle *phandle, const char *filename,
-              lt_dladvise advise, const lt_dlvtable *vtable)
+              lt_dladvise padvise, const lt_dlvtable *vtable)
 {
   lt__handle * handle          = (lt__handle *) handles;
   const char * saved_error     = 0;
   int          errors          = 0;
+  lt__advise *  advise         = (lt__advise *) padvise;
 
 #ifdef LT_DEBUG_LOADERS
   fprintf (stderr, "tryall_dlopen (%s, %s)\n",
@@ -407,11 +408,6 @@ tryall_dlopen (lt_dlhandle *phandle, const char *filename,
 
     do
       {
-       lt__advise *advise_taken = 0;
-
-       if (advise)
-         advise_taken = advise_dup ((lt__advise *) advise);
-
        if (vtable)
          loader_vtable = vtable;
        else
@@ -423,7 +419,7 @@ tryall_dlopen (lt_dlhandle *phandle, const char *filename,
                 filename ? filename : "(null)");
 #endif
        handle->module = (*loader_vtable->module_open) (loader_vtable->dlloader_data,
-                                                       filename, advise_taken);
+                                                       filename, advise);
 #ifdef LT_DEBUG_LOADERS
        fprintf (stderr, "  Result: %s\n",
                 handle->module ? "Success" : "Failed");
@@ -431,16 +427,14 @@ tryall_dlopen (lt_dlhandle *phandle, const char *filename,
 
        if (handle->module != 0)
          {
-           if (advise_taken)
+           if (advise)
              {
-               handle->info.is_resident  = advise_taken->is_resident;
-               handle->info.is_symglobal = advise_taken->is_symglobal;
-               handle->info.is_symlocal  = advise_taken->is_symlocal;
+               handle->info.is_resident  = advise->is_resident;
+               handle->info.is_symglobal = advise->is_symglobal;
+               handle->info.is_symlocal  = advise->is_symlocal;
              }
            break;
          }
-
-       FREE (advise_taken);
       }
     while (!vtable && (loader = lt_dlloader_next (loader)));