about summary refs log tree commit diff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-10-24 19:31:51 +0000
committerUlrich Drepper <drepper@redhat.com>2000-10-24 19:31:51 +0000
commite3e5f6725bfc4db3d861e6839caecfd16b762908 (patch)
tree25eac50fbe240807d5a42e7dc6cea1f36847fa99 /elf/dl-close.c
parent2e93b4a4cd190fc8d21682f69a5455dc6dcd04dd (diff)
downloadglibc-e3e5f6725bfc4db3d861e6839caecfd16b762908.tar.gz
glibc-e3e5f6725bfc4db3d861e6839caecfd16b762908.tar.xz
glibc-e3e5f6725bfc4db3d861e6839caecfd16b762908.zip
Update.
	* elf/dl-close.c (_dl_close): Don't free memory for global scope
	list immediately when empty.  Move code to...
	(free_mem): ...here.  Called as part of __libc_subfreeres list.
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index db11d3b50a..5f829223cc 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -249,6 +249,10 @@ _dl_close (void *_map)
 	}
     }
 
+  /* Notify the debugger those objects are finalized and gone.  */
+  _r_debug.r_state = RT_CONSISTENT;
+  _dl_debug_state ();
+
   /* Now we can perhaps also remove the modules for which we had
      dependencies because of symbol lookup.  */
   if (__builtin_expect (rellist != NULL, 0))
@@ -261,6 +265,14 @@ _dl_close (void *_map)
 
   free (list);
 
+  /* Release the lock.  */
+  __libc_lock_unlock (_dl_load_lock);
+}
+
+
+static void
+free_mem (void)
+{
   if (__builtin_expect (_dl_global_scope_alloc, 0) != 0
       && _dl_main_searchlist->r_nlist == _dl_initial_searchlist.r_nlist)
     {
@@ -276,11 +288,5 @@ _dl_close (void *_map)
       /* Now free the old map.  */
       free (old);
     }
-
-  /* Notify the debugger those objects are finalized and gone.  */
-  _r_debug.r_state = RT_CONSISTENT;
-  _dl_debug_state ();
-
-  /* Release the lock.  */
-  __libc_lock_unlock (_dl_load_lock);
 }
+text_set_element (__libc_subfreeres, free_mem);