From 752a2a50d4574791b2861653d4352c6b6e4b97ff Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 19 Aug 2000 07:17:09 +0000 Subject: Update. 2000-08-19 Ulrich Drepper * elf/Versions [ld] (GLIBC_2.2): Export _dl_check_map_versions. * elf/dl-deps.c (_dl_map_object_deps): If object was dependency of a dynamically loaded object remove old l_initfini list. * elf/dl-libc.c (free_mem): Used as __libc_subfreeres callback to remove some dynamically allocated memory blocks in the dynamic loading data structures. * elf/dl-load.c (add_name_to_object): Initialize dont_free to 0. * elf/dl-open.c (dl_open_workder): Don't call _dl_check_all_versions. Instead call _dl_check_map_versions only for the dependencies. * elf/rtld.c: Avoid unneccessary initializations. Mark l_libname information of initial objects as not free-able. * sysdeps/generic/ldsodefs.h (struct libname_list): Add dont_free element. * elf/filter.c: Call mtrace. * elf/restest1.c: Likewise. Close the objects. * elf/loadtest.c: Call mtrace. Check result of dlclose. Print more debug information. * elf/constload1.c: Add comment explaining not freed memory. --- elf/dl-libc.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'elf/dl-libc.c') 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); -- cgit v1.2.3