]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
libudev: also drop the entry from LIST even if unique flag is set
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 1 Feb 2021 17:16:01 +0000 (02:16 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 1 Feb 2021 17:28:33 +0000 (02:28 +0900)
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.

src/libudev/libudev-list.c

index c224e9df6d3232860c714e922ba4a79320bdd116..d42008e48d66b403a0dd0b080d8f3e121fd32ed5 100644 (file)
@@ -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);
         }