]> git.ipfire.org Git - thirdparty/systemd.git/commit
libudev: replace unique list entries in place 42903/head
authorLuca Boccassi <luca.boccassi@gmail.com>
Mon, 6 Jul 2026 17:37:23 +0000 (18:37 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 13 Jul 2026 12:03:27 +0000 (13:03 +0100)
commitdcfd156705d9ce7b3ff128d84a6628c946c3553a
tree23007f8b1d64719446a283f2a774af855cb49eb7
parent24dee4afc57e926575458d043c0bf82c695f88a3
libudev: replace unique list entries in place

udev_list_entry_add() freed the existing entry for a name before inserting
its replacement. Today that cannot lose the old entry, but only because
re-adding the key that was just removed never makes the hashmap grow, which
is an internal detail of the hashmap. Use hashmap_ensure_replace() instead:
it updates the existing bucket in place, making it explicit that replacing
an entry neither allocates nor can drop the previous value under OOM.

Follow-up for c01130824f22ec3835a35c8ab5f9aea65195a40f
src/libudev/libudev-list.c