HomeFreeBSD

Because nvp wasn't initialized on every loop iteration once we jumped

Description

Because nvp wasn't initialized on every loop iteration once we jumped
to 'fail' on error it was treated as success, because nvp!=NULL. Fix this
by not handling success under 'fail' label and by using separate variable
for parent nvpair.

If we succeeded to allocate nvlist, but failed to allocated nvpair we
would leak nvls[ii] on return. Destroy it when we cannot allocate nvpair,
before we goto fail.

Submitted by: pjd@ and oshogbo@ (minor changes)
Found by: scan-build
MFC after: 1 month
Sponsored by: Wheel Systems

Details

Provenance
oshogboAuthored on
Parents
rS323853: Make the code consistent by always using 'fail' label.
Branches
Unknown
Tags
Unknown