Summary: | makefs: Coverity CID 1305659: Unclear whether reaction on malloc failure suffices. | ||
---|---|---|---|
Product: | Base System | Reporter: | scdbackup |
Component: | bin | Assignee: | Enji Cooper <ngie> |
Status: | Closed FIXED | ||
Severity: | Affects Some People | CC: | ngie |
Priority: | --- | Keywords: | patch |
Version: | CURRENT | ||
Hardware: | Any | ||
OS: | Any |
Description
scdbackup
2015-10-08 19:38:49 UTC
--------------- Source analysis: I meanwhile learned that err() is also available in userspace and indeed exits its process. So it is not a potential SIGSEGV but just a surplus test. --------------- Remedy proposal: - if (var) - free(var); + free(var); Hmm, this is in bin, not kern. Oops. We've diverged a lot from upstream. Need to add emalloc to libc or libnetbsd to pull in the next set of changes from upstream for makefs. The 2-liner looks good though. I'll commit it to fix the Coverity issue. Thanks for looking into this issue. There is an upstream ? (Normally that's my role, but here i am friendly competitor.) Shall i put my findings there ? (PR 203531, 203644 to 203648) Please have a look at PR 203648 which i deem as obvious and simple as this one. A commit references this bug: Author: ngie Date: Mon Oct 19 18:45:14 UTC 2015 New revision: 289601 URL: https://svnweb.freebsd.org/changeset/base/289601 Log: Don't check if `val` is NULL before calling free; free(3) already handles this MFC after: 1 week PR: 203649 Submitted by: Thomas Schmitt <scdbackup@gmx.net> Coverity CID: 1305659 Sponsored by: EMC / Isilon Storage Division Changes: head/usr.sbin/makefs/cd9660.c (In reply to scdbackup from comment #4) I looked through the code and it's been completely refactored as of 2 years ago: http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/makefs/cd9660.c?rev=1.39&content-type=text/x-cvsweb-markup&only_with_tag=MAIN Well, i still find all four bugs of PR 203531 in NetBSD CVS. (Those flaws in FreeBSD 11 installation ISOs brought me to freebsd-hackers and to Coverity checks of makefs.) Is there some established way to share bugs between both projects ? A commit references this bug: Author: ngie Date: Mon Oct 26 03:53:49 UTC 2015 New revision: 289989 URL: https://svnweb.freebsd.org/changeset/base/289989 Log: MFC r289601: Don't check if `val` is NULL before calling free; free(3) already handles this PR: 203649 Submitted by: Thomas Schmitt <scdbackup@gmx.net> Coverity CID: 1305659 Sponsored by: EMC / Isilon Storage Division Changes: _U stable/10/ stable/10/usr.sbin/makefs/cd9660.c A commit references this bug: Author: ngie Date: Mon Oct 26 03:55:13 UTC 2015 New revision: 289990 URL: https://svnweb.freebsd.org/changeset/base/289990 Log: MFstable/10 r289989: MFC r289601: Don't check if `val` is NULL before calling free; free(3) already handles this PR: 203649 Submitted by: Thomas Schmitt <scdbackup@gmx.net> Coverity CID: 1305659 Sponsored by: EMC / Isilon Storage Division Changes: _U stable/9/ _U stable/9/usr.sbin/ _U stable/9/usr.sbin/makefs/ stable/9/usr.sbin/makefs/cd9660.c |