Bug 204956 - usr/src/usr.sbin/rpc.ypupdated/update.c:270: resource leak
Summary: usr/src/usr.sbin/rpc.ypupdated/update.c:270: resource leak
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Andriy Voskoboinyk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-02 08:45 UTC by David Binderman
Modified: 2019-03-04 03:33 UTC (History)
2 users (show)

See Also:
avos: mfc-stable12+
avos: mfc-stable11+
avos: mfc-stable10+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2015-12-02 08:45:16 UTC
[usr/src/usr.sbin/rpc.ypupdated/update.c:270]: (error) Resource leak: rf

    rf = fopen(filename, "r");
    if (rf == NULL) {
        return (ERR_READ);
    }
    wf = fopen(tmpname, "w");
    if (wf == NULL) {
        return (ERR_WRITE);
    }
Comment 1 Pedro F. Giffuni freebsd_committer freebsd_triage 2017-11-04 20:33:01 UTC
Confirmed by Coverity:

CID 1007425 (#1 of 1): Resource leak (RESOURCE_LEAK)
8. leaked_storage: Variable rf going out of scope leaks the storage it points to.
Comment 2 commit-hook freebsd_committer freebsd_triage 2019-02-18 03:16:29 UTC
A commit references this bug:

Author: avos
Date: Mon Feb 18 03:15:25 UTC 2019
New revision: 344244
URL: https://svnweb.freebsd.org/changeset/base/344244

Log:
  Fix memory / resource leaks in usr.sbin/rpc.ypupdated/update.c

  Re-apply r343909 to this file to get the issue fixed.

  PR:		204956
  Reported by:	David Binderman <dcb314@hotmail.com>
  MFC after:	5 days

Changes:
  head/usr.sbin/rpc.ypupdated/update.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2019-03-04 03:31:01 UTC
A commit references this bug:

Author: avos
Date: Mon Mar  4 03:30:40 UTC 2019
New revision: 344746
URL: https://svnweb.freebsd.org/changeset/base/344746

Log:
  MFC r344244:
  Fix memory / resource leaks in usr.sbin/rpc.ypupdated/update.c

  Re-apply r343909 to this file to get the issue fixed.

  PR:		204956
  Reported by:	David Binderman <dcb314@hotmail.com>

Changes:
_U  stable/10/
  stable/10/usr.sbin/rpc.ypupdated/update.c
_U  stable/11/
  stable/11/usr.sbin/rpc.ypupdated/update.c
_U  stable/12/
  stable/12/usr.sbin/rpc.ypupdated/update.c