aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/editmap
diff options
context:
space:
mode:
authorDavid Bright <dab@FreeBSD.org>2019-02-08 13:54:16 +0000
committerDavid Bright <dab@FreeBSD.org>2019-02-08 13:54:16 +0000
commit00c4df53b6637bc37756fee95f7b361139036a02 (patch)
treeef6c214734dc680bbd3a12721273563b4d25a9e1 /usr.sbin/editmap
parent2d3a84f5b080796db39aa2c0456d19d49fdd6132 (diff)
downloadsrc-00c4df53b6637bc37756fee95f7b361139036a02.tar.gz
src-00c4df53b6637bc37756fee95f7b361139036a02.zip
Fix several Coverity-detected issues in newsyslog.
- CID 1394815, CID 1305673: Dereference before null check - memory was allocated and the allocation checked for NULL with a call to errx() if it failed. Code below that was guaranteed that the pointer was non-NULL, but there was another check for NULL at the exit of the function (after the memory had already been referenced). Eliminate the useless NULL check. - CID 1007454, CID 1007453: Resource leak - The result of a strdup() was stored in a global variable and not freed before program exit. - CID 1007452: Resource leak - Storage intended to be allocated and returned to the caller was never freed. This was the result of a regression in the function signature introduced in r208648 (2010) (thanks for that find, @cem!). Fixed by altering the function signature and passing the allocated memory to the caller as intended. This also fixes PR158794. - CID 1008620: Logically dead code in newsyslog.c - This was a direct result of CID 1007452. Since the memory allocated as described there was not returned to the caller, a subsequent check for the memory having been allocated was dead code. Returning the memory re-animates the code that is the subject of this CID. - CID 1006131: Unused value - in parsing a configuration file, a pointer to the end of the last field was saved, but not used after that. Rewrite to use the pointer value. This could have been fixed by avoiding the assignment altogether, but this solutions more closely follows the pattern used in the preceding code. PR: 158794 Reported by: Coverity, Ken-ichi EZURA <k.ezura@gmail.com> (PR158794) Reviewed by: cem, markj MFC after: 1 week Sponsored by: Dell EMC Isilon
Notes
Notes: svn path=/head/; revision=343906
Diffstat (limited to 'usr.sbin/editmap')
0 files changed, 0 insertions, 0 deletions