Bug 204955 - usr/src/usr.sbin/lpr/common_source/ctlinfo.c:294: resource leak ?
Summary: usr/src/usr.sbin/lpr/common_source/ctlinfo.c:294: 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: Garance A Drosehn
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-02 08:42 UTC by David Binderman
Modified: 2018-04-19 18:03 UTC (History)
1 user (show)

See Also:


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:42:41 UTC
[usr/src/usr.sbin/lpr/common_source/ctlinfo.c:294]: (error) Resource leak: cfile

Source code is

   if (cstart == NULL)
        return NULL;
Comment 1 Pedro F. Giffuni freebsd_committer freebsd_triage 2017-11-04 20:26:51 UTC
Confirmed by Coverity:

CID 1006860 (#1 of 1): Resource leak (RESOURCE_LEAK)
5. leaked_storage: Variable cfile going out of scope leaks the storage it points to.
Comment 2 commit-hook freebsd_committer freebsd_triage 2018-03-12 01:41:56 UTC
A commit references this bug:

Author: gad
Date: Mon Mar 12 01:41:16 UTC 2018
New revision: 330787
URL: https://svnweb.freebsd.org/changeset/base/330787

Log:
  Fix the resource leak of a 'FILE *' which could happen in routine
  ctl_readcf() if a call to malloc failed.

  PR:		204955
  Reported by:	David Binderman

Changes:
  head/usr.sbin/lpr/common_source/ctlinfo.c