svn commit: r343722 - stable/12/usr.bin/compress

Oleksandr Tymoshenko gonzo at FreeBSD.org
Sun Feb 3 21:18:47 UTC 2019


Author: gonzo
Date: Sun Feb  3 21:18:46 2019
New Revision: 343722
URL: https://svnweb.freebsd.org/changeset/base/343722

Log:
  MFC r343127:
  
  Fix descriptor/memory leak in compress(1) code
  
  This is mostly a style fix since the code in question is not called multiple
  times and doesn't have cummulative effect.
  
  PR:		204953
  Submitted by:	David Binderman <dcb314 at hotmail.com>

Modified:
  stable/12/usr.bin/compress/compress.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/compress/compress.c
==============================================================================
--- stable/12/usr.bin/compress/compress.c	Sun Feb  3 21:17:26 2019	(r343721)
+++ stable/12/usr.bin/compress/compress.c	Sun Feb  3 21:18:46 2019	(r343722)
@@ -322,6 +322,8 @@ decompress(const char *in, const char *out, int bits)
 	if ((ofp = fopen(out, "w")) == NULL ||
 	    (nr != 0 && fwrite(buf, 1, nr, ofp) != nr)) {
 		cwarn("%s", out);
+		if (ofp)
+			(void)fclose(ofp);
 		(void)fclose(ifp);
 		return;
 	}


More information about the svn-src-stable mailing list