]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
libudev: unset uptodate flag before free()ing entries
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 1 Feb 2021 17:34:20 +0000 (02:34 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 1 Feb 2021 17:34:23 +0000 (02:34 +0900)
udev_list_entry_free() also removes the entry from LIST if the flag is
set. This slightly optimizes the cleanup logic.

src/libudev/libudev-list.c

index d42008e48d66b403a0dd0b080d8f3e121fd32ed5..d992d1879bfe7d9f6c070eb42d53d493f5053378 100644 (file)
@@ -115,8 +115,8 @@ void udev_list_cleanup(struct udev_list *list) {
                 return;
 
         if (list->unique) {
-                hashmap_clear_with_destructor(list->unique_entries, udev_list_entry_free);
                 list->uptodate = false;
+                hashmap_clear_with_destructor(list->unique_entries, udev_list_entry_free);
         } else
                 LIST_FOREACH_SAFE(entries, i, n, list->entries)
                         udev_list_entry_free(i);