Red Hat Bugzilla – Bug 785760
libtar: file descriptor leaks reported by cppcheck
Last modified: 2015-05-19 07:47:37 EDT
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):
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
[/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
Created attachment 559936 [details]
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
fixed in libtar-1.2.11-27.fc21
It is too late to fix the bug in RHEL-6. I am moving it to RHEL-7...
up2date cppcheck does not detect the descriptor leaks above. However, it detects a memory leak on OOM path, which I reported upstream:
... but I am not going to fix that one in RHEL.
reproducible with cppcheck-1.53
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.