Bug 204953

Summary: usr/src/usr.bin/compress/compress.c:324: resource leak ?
Product: Base System Reporter: David Binderman <dcb314>
Component: miscAssignee: Oleksandr Tymoshenko <gonzo>
Status: Closed FIXED    
Severity: Affects Some People CC: gonzo
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description David Binderman 2015-12-02 08:31:48 UTC
[usr/src/usr.bin/compress/compress.c:324]: (error) Resource leak: ofp

Source code is

    if ((ofp = fopen(out, "w")) == NULL ||
        (nr != 0 && fwrite(buf, 1, nr, ofp) != nr)) {
        cwarn("%s", out);
        (void)fclose(ifp);
        return;
    }
Comment 1 commit-hook freebsd_committer freebsd_triage 2019-01-18 00:26:30 UTC
A commit references this bug:

Author: gonzo
Date: Fri Jan 18 00:26:25 UTC 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@hotmail.com>
  MFC after:	1 week

Changes:
  head/usr.bin/compress/compress.c
Comment 2 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2019-01-18 00:35:35 UTC
Fix committed. Thanks for submitting.
Comment 3 commit-hook freebsd_committer freebsd_triage 2019-02-03 21:19:36 UTC
A commit references this bug:

Author: gonzo
Date: Sun Feb  3 21:18:46 UTC 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@hotmail.com>

Changes:
_U  stable/12/
  stable/12/usr.bin/compress/compress.c