about summary refs log tree commit diff
path: root/malloc
diff options
context:
space:
mode:
Diffstat (limited to 'malloc')
-rw-r--r--malloc/set-freeres.c10
-rw-r--r--malloc/thread-freeres.c2
2 files changed, 5 insertions, 7 deletions
diff --git a/malloc/set-freeres.c b/malloc/set-freeres.c
index 817fbea8b8..d404250151 100644
--- a/malloc/set-freeres.c
+++ b/malloc/set-freeres.c
@@ -20,6 +20,7 @@
 #include <set-hooks.h>
 #include <libc-internal.h>
 #include <unwind-link.h>
+#include <dlfcn/dlerror.h>
 
 #include "../nss/nsswitch.h"
 #include "../libio/libioP.h"
@@ -28,8 +29,6 @@ DEFINE_HOOK (__libc_subfreeres, (void));
 
 symbol_set_define (__libc_freeres_ptrs);
 
-extern __attribute__ ((weak)) void __libdl_freeres (void);
-
 extern __attribute__ ((weak)) void __libpthread_freeres (void);
 
 void __libc_freeres_fn_section
@@ -52,11 +51,6 @@ __libc_freeres (void)
       /* We run the resource freeing after IO cleanup.  */
       RUN_HOOK (__libc_subfreeres, ());
 
-      /* Call the libdl list of cleanup functions
-	 (weak-ref-and-check).  */
-      if (&__libdl_freeres != NULL)
-	__libdl_freeres ();
-
       /* Call the libpthread list of cleanup functions
 	 (weak-ref-and-check).  */
       if (&__libpthread_freeres != NULL)
@@ -66,6 +60,8 @@ __libc_freeres (void)
       __libc_unwind_link_freeres ();
 #endif
 
+      call_function_static_weak (__libc_dlerror_result_free);
+
       for (p = symbol_set_first_element (__libc_freeres_ptrs);
            !symbol_set_end_p (__libc_freeres_ptrs, p); ++p)
         free (*p);
diff --git a/malloc/thread-freeres.c b/malloc/thread-freeres.c
index da76a3dca7..77a204f9fa 100644
--- a/malloc/thread-freeres.c
+++ b/malloc/thread-freeres.c
@@ -16,6 +16,7 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <dlfcn/dlerror.h>
 #include <libc-internal.h>
 #include <malloc-internal.h>
 #include <resolv/resolv-internal.h>
@@ -36,6 +37,7 @@ __libc_thread_freeres (void)
 #endif
   call_function_static_weak (__res_thread_freeres);
   __glibc_tls_internal_free ();
+  call_function_static_weak (__libc_dlerror_result_free);
 
   /* This should come last because it shuts down malloc for this
      thread and the other shutdown functions might well call free.  */