diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-06-25 00:47:28 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-06-25 00:47:28 -0400 |
commit | e8dbf00a789e3b56ca6c3d88e8048b7b2c18b797 (patch) | |
tree | 60ec805748f446b2c8b6e8e7a71c05b7d30fc884 | |
parent | 368ba4a0a9aa5cc9a769872adbef6da433babf54 (diff) | |
download | musl-e8dbf00a789e3b56ca6c3d88e8048b7b2c18b797.tar.gz musl-e8dbf00a789e3b56ca6c3d88e8048b7b2c18b797.tar.bz2 musl-e8dbf00a789e3b56ca6c3d88e8048b7b2c18b797.tar.xz musl-e8dbf00a789e3b56ca6c3d88e8048b7b2c18b797.zip |
discard dso descriptors after performing relocations
eventually (once dlopen exists) this behavior will be conditional on
dlopen/dlsym not being reachable.
-rw-r--r-- | src/ldso/dynlink.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index cb35759b..105ed3d7 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -322,6 +322,16 @@ static void reloc_all(struct dso *p) } } +static void free_all(struct dso *p) +{ + struct dso *n; + while (p) { + n = p->next; + if (p->map) free(p); + p = n; + } +} + void *__dynlink(int argc, char **argv, size_t *got) { size_t *auxv, aux[AUX_CNT] = {0}; @@ -387,6 +397,8 @@ void *__dynlink(int argc, char **argv, size_t *got) reloc_all(head); + free_all(head); + errno = 0; return (void *)aux[AT_ENTRY]; } |