Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Feb 2015 03:29:47 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r278983 - head/sys/kern
Message-ID:  <201502190329.t1J3TlnJ087569@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502190329.t1J3TlnJ087569>