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 <dcb...@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;
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to