Page MenuHomeFreeBSD

Don't allocate memory for operations that do not insert
ClosedPublic

Authored by rstone on Feb 17 2015, 5:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 3:28 AM
Unknown Object (File)
Tue, Nov 5, 12:58 PM
Unknown Object (File)
Thu, Oct 31, 9:56 AM
Unknown Object (File)
Oct 4 2024, 9:02 PM
Unknown Object (File)
Oct 4 2024, 7:35 PM
Unknown Object (File)
Oct 4 2024, 6:31 PM
Unknown Object (File)
Sep 30 2024, 1:45 PM
Unknown Object (File)
Sep 30 2024, 12:38 PM

Details

Summary

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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

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 edited edge metadata.
This revision is now accepted and ready to land.Feb 18 2015, 10:27 PM
lib/libnv/nvlist.c
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 updated this revision to Diff 4039.

Closed by commit rS279435 (authored by @rstone).