diff options
author | markj <markj@FreeBSD.org> | 2015-02-19 03:29:46 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2015-02-19 03:29:46 +0000 |
commit | 8aabcd8ae584cc50c92f1f92f9a433bcbcb87c52 (patch) | |
tree | 0989af80bfa83eed13b740f385fe42b4d2f264fe | |
parent | de8b07b49541c07c3bc869122f582867bb45f4c9 (diff) | |
download | FreeBSD-src-8aabcd8ae584cc50c92f1f92f9a433bcbcb87c52.zip FreeBSD-src-8aabcd8ae584cc50c92f1f92f9a433bcbcb87c52.tar.gz |
Free the zlib stream after expanding a compressed CTF section.
Note that this memory would only be leaked once, since CTF info for a kld
file is cached after the first access.
MFC after: 3 days
-rw-r--r-- | sys/kern/kern_ctf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_ctf.c b/sys/kern/kern_ctf.c index 319414c..e69caf5 100644 --- a/sys/kern/kern_ctf.c +++ b/sys/kern/kern_ctf.c @@ -293,7 +293,9 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) zs.next_in = ((uint8_t *) raw) + sizeof(ctf_hdr); zs.avail_out = sz - sizeof(ctf_hdr); zs.next_out = ((uint8_t *) ctftab) + sizeof(ctf_hdr); - if ((ret = inflate(&zs, Z_FINISH)) != Z_STREAM_END) { + ret = inflate(&zs, Z_FINISH); + inflateEnd(&zs); + if (ret != Z_STREAM_END) { printf("%s(%d): zlib inflate returned %d\n", __func__, __LINE__, ret); error = EIO; goto out; |