Author: markj
Date: Thu Feb 19 03:29:46 2015
New Revision: 278983
URL: https://svnweb.freebsd.org/changeset/base/278983

Log:
  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

Modified:
  head/sys/kern/kern_ctf.c

Modified: head/sys/kern/kern_ctf.c
==============================================================================
--- head/sys/kern/kern_ctf.c    Thu Feb 19 02:56:34 2015        (r278982)
+++ head/sys/kern/kern_ctf.c    Thu Feb 19 03:29:46 2015        (r278983)
@@ -293,7 +293,9 @@ link_elf_ctf_get(linker_file_t lf, linke
                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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to