Page MenuHomeFreeBSD

Don't allocate memory for operations that do not insert

Authored by rstone on Feb 17 2015, 5:45 PM.



Almost every operation performed on an nvlist was allocating a
new string to hold the key name. The nvlist_exists* family of
functions would always return false if they failed to allocate
the string. The rest of the functions would outright abort().
Fix the non-varargs variants of the functions to perform the
requested operations directly and the varargs versions to
allocate the string and call into the non-varargs versions.
The varargs versions are still broken and really can't be fixed,
so we might consider axing them entirely. However, now the non-
varargs functions are always safe to call.

Diff Detail

rS FreeBSD src repository
Lint Skipped
Unit Tests Skipped

Event Timeline

rstone updated this revision to Diff 3822.Feb 17 2015, 5:45 PM
rstone retitled this revision from to Don't allocate memory for operations that do not insert.
rstone edited the test plan for this revision. (Show Details)
rstone added a reviewer: jfv.
rstone updated this object.
rstone added subscribers: pjd, Unknown Object (MLST).
jfv accepted this revision.Feb 18 2015, 10:27 PM
jfv edited edge metadata.
This revision is now accepted and ready to land.Feb 18 2015, 10:27 PM
pjd added inline comments.Feb 19 2015, 8:50 AM
276 ↗(On Diff #3822)

'false' should be returned here.

1094 ↗(On Diff #3822)

'false' instead of '0'.

1111 ↗(On Diff #3822)

'false', not '0'.

rstone closed this revision.Mar 1 2015, 12:22 AM
rstone updated this revision to Diff 4039.

Closed by commit rS279435 (authored by @rstone).