diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-10-07 18:24:14 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-10-07 18:24:14 +0000 |
commit | fd346efa51dc5172ba9308c33159916372629faa (patch) | |
tree | 3a8807d29832cd4ce0235d8076c639250258039a | |
parent | bf24f67632e9fc2d4cab3d5b0b31a951164f304e (diff) | |
download | glibc-fd346efa51dc5172ba9308c33159916372629faa.tar.gz glibc-fd346efa51dc5172ba9308c33159916372629faa.tar.xz glibc-fd346efa51dc5172ba9308c33159916372629faa.zip |
(_dl_close): Fix a memory leak.
Update _dl_global_scope[2] if the first object on the list is removed.
-rw-r--r-- | elf/dl-close.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c index ee35c6d508..ab650bc748 100644 --- a/elf/dl-close.c +++ b/elf/dl-close.c @@ -117,11 +117,17 @@ _dl_close (struct link_map *map) if (imap->l_prev) imap->l_prev->l_next = imap->l_next; else - _dl_loaded = imap->l_next; + { + if (_dl_global_scope[2] == imap) + _dl_global_scope[2] = imap->l_next; + _dl_loaded = imap->l_next; + } if (imap->l_next) imap->l_next->l_prev = imap->l_prev; if (imap->l_searchlist && imap->l_searchlist != list) free (imap->l_searchlist); + free (imap->l_name); + free ((char *) imap->l_libname); free (imap); } } |