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)
Jan 8 2024, 11:08 AM
Unknown Object (File)
Dec 27 2023, 11:03 PM
Unknown Object (File)
Dec 23 2023, 6:26 AM
Unknown Object (File)
Dec 19 2023, 11:11 PM
Unknown Object (File)
Nov 26 2023, 9:34 PM
Unknown Object (File)
Nov 5 2023, 3:09 AM
Unknown Object (File)
Nov 1 2023, 9:01 AM
Unknown Object (File)
Sep 10 2023, 12:14 AM

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).