mirror of
https://github.com/systemd/systemd.git
synced 2024-10-28 03:25:31 +03:00
sd-device: use trivial_hash_ops_free_free for managing match sysattrs or properties
This fixes an issue caused by eb1c1dc029
.
Before the commit, multiple values can be specified for the same
sysattr or property.
Fixes #17259.
This commit is contained in:
parent
5e71868ced
commit
a0887abbd8
@ -118,7 +118,7 @@ _public_ int sd_device_enumerator_add_match_sysattr(sd_device_enumerator *enumer
|
|||||||
else
|
else
|
||||||
hashmap = &enumerator->nomatch_sysattr;
|
hashmap = &enumerator->nomatch_sysattr;
|
||||||
|
|
||||||
r = hashmap_put_strdup(hashmap, sysattr, value);
|
r = hashmap_put_strdup_full(hashmap, &trivial_hash_ops_free_free, sysattr, value);
|
||||||
if (r <= 0)
|
if (r <= 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ _public_ int sd_device_enumerator_add_match_property(sd_device_enumerator *enume
|
|||||||
assert_return(enumerator, -EINVAL);
|
assert_return(enumerator, -EINVAL);
|
||||||
assert_return(property, -EINVAL);
|
assert_return(property, -EINVAL);
|
||||||
|
|
||||||
r = hashmap_put_strdup(&enumerator->match_property, property, value);
|
r = hashmap_put_strdup_full(&enumerator->match_property, &trivial_hash_ops_free_free, property, value);
|
||||||
if (r <= 0)
|
if (r <= 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user