summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-05-24 10:33:02 +0000
committerJakub Jelinek <jakub@redhat.com>2007-05-24 10:33:02 +0000
commit619b79105b34179aab8ade7f232e2cfc505a22ed (patch)
tree265582300d98ffe130b2e76ff46f50834e6cdaa1 /elf
parent75831cc48d3fef9b0bb247aabbcdaceef85efa23 (diff)
downloadglibc-619b79105b34179aab8ade7f232e2cfc505a22ed.tar.gz
glibc-619b79105b34179aab8ade7f232e2cfc505a22ed.tar.xz
glibc-619b79105b34179aab8ade7f232e2cfc505a22ed.zip
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-open.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 583878781e..0afe94b5bf 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -125,14 +125,18 @@ add_to_global (struct link_map *new)
     {
       /* We have to extend the existing array of link maps in the
 	 main map.  */
+      size_t new_size = ns->_ns_global_scope_alloc;
+      if (new_size >= 256 && new_size > to_add + 8)
+	new_size *= 2;
+      else
+	new_size += to_add + 8;
       new_global = (struct link_map **)
 	realloc (ns->_ns_main_searchlist->r_list,
-		 ((ns->_ns_global_scope_alloc + to_add + 8)
-		  * sizeof (struct link_map *)));
+		 new_size * sizeof (struct link_map *));
       if (new_global == NULL)
 	goto nomem;
 
-      ns->_ns_global_scope_alloc += to_add + 8;
+      ns->_ns_global_scope_alloc = new_size;
       ns->_ns_main_searchlist->r_list = new_global;
     }