Bug 785760 - libtar: file descriptor leaks reported by cppcheck
libtar: file descriptor leaks reported by cppcheck
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libtar (Show other bugs)
7.0
Unspecified Unspecified
medium Severity low
: alpha
: 7.2
Assigned To: Kamil Dudka
qe-baseos-daemons
: Patch
Depends On:
Blocks: 1191020
  Show dependency treegraph
 
Reported: 2012-01-30 09:57 EST by Karel Volný
Modified: 2015-05-19 07:47 EDT (History)
3 users (show)

See Also:
Fixed In Version: libtar-1.2.11-29.el7
Doc Type: Bug Fix
Doc Text:
Previously, the error handling code in libtar did not properly release file descriptors before losing track of them. This led to unnecessary file descriptor leakage. An upstream patch has been applied on libtar source code to properly release file descriptors on error paths. Now, libtar no longer leaks file descriptors.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-05-18 04:22:19 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
proposed fix (1.90 KB, patch)
2012-02-07 08:08 EST, Kamil Dudka
kdudka: review? (huzaifas)
Details | Diff

  None (edit)
Description Karel Volný 2012-01-30 09:57:11 EST
Description of problem:
Running cppcheck on libtar sources reports several errors - resource leaks.
As far as I can understand the source code, these are valid concerns, files are being opened, and in case of some errors, the functions exit without closing the files.

Version-Release number of selected component (if applicable):
libtar-1.2.11-17.el6

How reproducible:
always

Steps to Reproduce:
1. rpm -i libtar-1.2.11-17.el6.src.rpm
2. cppcheck /root/rpmbuild/BUILD/libtacat newr-1.2.11/ | grep error
  
Actual results:
[/root/rpmbuild/BUILD/libtar-1.2.11/lib/append.c:237]: (error) Resource leak: filefd
[/root/rpmbuild/BUILD/libtar-1.2.11/lib/extract.c:249]: (error) Resource leak: fdout
[/root/rpmbuild/BUILD/libtar-1.2.11/libtar/libtar.c:86]: (error) Resource leak: fd


Expected results:
(no output)

Additional info:
Comment 1 Kamil Dudka 2012-02-07 08:08:27 EST
Created attachment 559936 [details]
proposed fix
Comment 3 Suzanne Yeghiayan 2012-02-14 18:29:39 EST
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.
Comment 8 Kamil Dudka 2013-10-04 08:47:57 EDT
fixed in libtar-1.2.11-27.fc21
Comment 11 Kamil Dudka 2014-10-23 11:26:46 EDT
It is too late to fix the bug in RHEL-6.  I am moving it to RHEL-7...
Comment 13 Kamil Dudka 2015-04-21 14:51:04 EDT
up2date cppcheck does not detect the descriptor leaks above.  However, it detects a memory leak on OOM path, which I reported upstream:

https://lists.feep.net:8080/pipermail/libtar/2015-April/000412.html

... but I am not going to fix that one in RHEL.
Comment 14 Kamil Dudka 2015-04-22 11:07:56 EDT
reproducible with cppcheck-1.53
Comment 21 errata-xmlrpc 2015-05-18 04:22:19 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1014.html

Note You need to log in before you can comment on or make changes to this bug.