about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-09-19 22:22:51 +0000
committerUlrich Drepper <drepper@redhat.com>2007-09-19 22:22:51 +0000
commit715899d1221ca1336926ec2467288265a7888be6 (patch)
treeef42910b8ee7c51c711790a854742a6407c66a2d
parente1db0493fdc908aae2a597c82dcd9fbaff14e9dc (diff)
downloadglibc-715899d1221ca1336926ec2467288265a7888be6.tar.gz
glibc-715899d1221ca1336926ec2467288265a7888be6.tar.xz
glibc-715899d1221ca1336926ec2467288265a7888be6.zip
* elf/dl-lookup.c (add_dependency): Handle failing memory cvs/fedora-glibc-20070920T0007
	allocation for dependency list.  Remove unnecessary check.
-rw-r--r--ChangeLog3
-rw-r--r--elf/dl-lookup.c12
2 files changed, 9 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index f4de7596a4..38453902d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2007-09-19  Ulrich Drepper  <drepper@redhat.com>
 
+	* elf/dl-lookup.c (add_dependency): Handle failing memory
+	allocation for dependency list.  Remove unnecessary check.
+
 	* sysdeps/posix/getaddrinfo.c (getaddrinfo): Avoid unnecessary
 	open/close when determining source addresses.
 
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index ce28f8631c..c529007ca1 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -162,8 +162,8 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags)
 	goto out_check;
 
       /* Avoid references to objects which cannot be unloaded anyway.  */
-      if (map->l_type != lt_loaded
-	  || (map->l_flags_1 & DF_1_NODELETE) != 0)
+      assert (map->l_type == lt_loaded);
+      if ((map->l_flags_1 & DF_1_NODELETE) != 0)
 	goto out;
 
       /* If the object with the undefined reference cannot be removed ever
@@ -197,13 +197,13 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags)
 	}
 
       /* If we didn't manage to allocate memory for the list this is
-	 no fatal mistake.  We simply increment the use counter of the
-	 referenced object and don't record the dependencies.  This
-	 means this increment can never be reverted and the object
-	 will never be unloaded.  This is semantically the correct
+	 no fatal mistake.  We simply make sure the referenced object
+	 cannot be unloaded.  This is semantically the correct
 	 behavior.  */
       if (__builtin_expect (act < undef_map->l_reldepsmax, 1))
 	undef_map->l_reldeps[undef_map->l_reldepsact++] = map;
+      else
+	map->l_flags_1 |= DF_1_NODELETE;
 
       /* Display information if we are debugging.  */
       if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))