Page MenuHomeFreeBSD

Fix Coverity CIDs 1018708 and 1018709 in libstand/nfs.c (and other fixes)
Needs ReviewPublic

Authored by truckman on May 24 2016, 5:38 AM.

Details

Reviewers
rmacklem
mav
Summary

The free(newfd) and free(path) calls can be passed unitialized
pointers if the

	currfd = malloc()

call fails. Fix this by setting these pointers to NULL earlier.

Also *path is not used in the NFS_NOSYMLINK case, so move its
declaration inside the #ifndef block.

Fix two compile errors in the NFS_NOSYMLINK case:

	currfd = malloc(sizeof(*newfd));

which fails because newfd is not defined, and

	goto out;

which fails because the label is inside an #ifndef NFS_NOSYMLINK
block. Fix the latter by rearranging the function epilog a bit.

Also, fix the OLD_NFSV2 version of the code.

Test Plan

Compile all four combinations of OLD_NFSV2 and NFS_NOSYMLINK.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 3918
Build 3961: arc lint + arc unit

Event Timeline

truckman retitled this revision from to Fix Coverity CIDs 1018708 and 1018709 in libstand/nfs.c (and other fixes).
truckman updated this object.
truckman edited the test plan for this revision. (Show Details)
truckman added reviewers: mav, rmacklem.