about summary refs log tree commit diff
path: root/elf/dl-libc.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-libc.c')
-rw-r--r--elf/dl-libc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/elf/dl-libc.c b/elf/dl-libc.c
index 992a52e699..8518909b25 100644
--- a/elf/dl-libc.c
+++ b/elf/dl-libc.c
@@ -120,3 +120,27 @@ __libc_dlclose (void *__map)
 {
   return dlerror_run (do_dlclose, __map);
 }
+
+
+static void
+free_mem (void)
+{
+  struct link_map *l;
+
+  /* Remove all additional names added to the objects.  */
+  for (l = _dl_loaded; l != NULL; l = l->l_next)
+    {
+      struct libname_list *lnp = l->l_libname->next;
+
+      l->l_libname->next = NULL;
+
+      while (lnp != NULL)
+	{
+	  struct libname_list *old = lnp;
+	  lnp = lnp->next;
+	  if (! old->dont_free)
+	    free (old);
+	}
+    }
+}
+text_set_element (__libc_subfreeres, free_mem);