svn commit: r343127 - head/usr.bin/compress
Oleksandr Tymoshenko
gonzo at FreeBSD.org
Fri Jan 18 00:26:26 UTC 2019
Author: gonzo
Date: Fri Jan 18 00:26:25 2019
New Revision: 343127
URL: https://svnweb.freebsd.org/changeset/base/343127
Log:
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>
MFC after: 1 week
Modified:
head/usr.bin/compress/compress.c
Modified: head/usr.bin/compress/compress.c
==============================================================================
--- head/usr.bin/compress/compress.c Thu Jan 17 23:22:56 2019 (r343126)
+++ head/usr.bin/compress/compress.c Fri Jan 18 00:26:25 2019 (r343127)
@@ -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-all
mailing list