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)
Sat, Feb 4, 8:03 PM
Unknown Object (File)
Sun, Jan 8, 2:21 PM
Unknown Object (File)
Jan 7 2023, 8:32 AM
Unknown Object (File)
Dec 26 2022, 8:37 AM
Unknown Object (File)
Dec 24 2022, 2:13 AM
Unknown Object (File)
Apr 24 2017, 2:40 PM
Unknown Object (File)
Apr 23 2017, 2:54 PM
Unknown Object (File)
Apr 21 2017, 10:25 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).