diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-02-02 02:16:01 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-02-02 02:28:33 +0900 |
commit | 8e5ce38727246a213d88f43da72ae2769d99d3f6 (patch) | |
tree | 378b74ca6a6ad2b4bd3657c187f3906fdb039083 /src | |
parent | 140716a51694ad2aa365869e3f8a741509a70959 (diff) | |
download | systemd-8e5ce38727246a213d88f43da72ae2769d99d3f6.tar.gz |
libudev: also drop the entry from LIST even if unique flag is set
Otherwise, the list becomes dirty when an entry is freed.
This also remove the entry from the hashmap only when its name is set.
The name should be always set, so that does not change anything. But
just for safety.
Diffstat (limited to 'src')
-rw-r--r-- | src/libudev/libudev-list.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libudev/libudev-list.c b/src/libudev/libudev-list.c index c224e9df6d..d42008e48d 100644 --- a/src/libudev/libudev-list.c +++ b/src/libudev/libudev-list.c @@ -39,9 +39,10 @@ static struct udev_list_entry *udev_list_entry_free(struct udev_list_entry *entr return NULL; if (entry->list) { - if (entry->list->unique) + if (entry->list->unique && entry->name) hashmap_remove(entry->list->unique_entries, entry->name); - else + + if (!entry->list->unique || entry->list->uptodate) LIST_REMOVE(entries, entry->list->entries, entry); } |