diff options
author | kchow <none@none> | 2007-06-21 10:47:34 -0700 |
---|---|---|
committer | kchow <none@none> | 2007-06-21 10:47:34 -0700 |
commit | 66f0458f9b1bd71f3747ed0cc7dc7d8725f1ce6e (patch) | |
tree | 8848adb28dc3a4ef640619a55ec6a9c4f5d8d724 /usr/src/uts/common/krtld | |
parent | 10ddde3aee60d88fa580028fcf7642a87e80a2c6 (diff) | |
download | illumos-joyent-66f0458f9b1bd71f3747ed0cc7dc7d8725f1ce6e.tar.gz |
6196513 Memory leak in get_syms
Diffstat (limited to 'usr/src/uts/common/krtld')
-rw-r--r-- | usr/src/uts/common/krtld/kobj.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/usr/src/uts/common/krtld/kobj.c b/usr/src/uts/common/krtld/kobj.c index 1e12d0923b..7a0427265e 100644 --- a/usr/src/uts/common/krtld/kobj.c +++ b/usr/src/uts/common/krtld/kobj.c @@ -1638,8 +1638,24 @@ kobj_export_ksyms(struct module *mp) /* * Free the old section headers -- we'll never need them again. */ - if (!(mp->flags & KOBJ_PRIM)) + if (!(mp->flags & KOBJ_PRIM)) { + uint_t shn; + Shdr *shp; + + for (shn = 1; shn < omp->hdr.e_shnum; shn++) { + shp = (Shdr *)(omp->shdrs + shn * omp->hdr.e_shentsize); + switch (shp->sh_type) { + case SHT_RELA: + case SHT_REL: + if (shp->sh_addr != 0) { + kobj_free((void *)shp->sh_addr, + shp->sh_size); + } + break; + } + } kobj_free(omp->shdrs, omp->hdr.e_shentsize * omp->hdr.e_shnum); + } /* * Discard the old symbol table and our copy of the module strucure. */ |