libudev: set entry->list after the entry is stored in the list

This should not change anything. As hashmap_remove() is called before
hashmap_ensure_put(). So, even if hashmap_ensure_put() fails, a wrong
entry will not removed from the hashmap by udev_list_entry_free().
But anyway, just for safety.
This commit is contained in:
Yu Watanabe
2021-02-02 02:22:59 +09:00
parent eaef130d3f
commit 140716a516
+2 -1
View File
@@ -88,7 +88,6 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *
return NULL;
*entry = (struct udev_list_entry) {
.list = list,
.name = TAKE_PTR(name),
.value = TAKE_PTR(value),
};
@@ -103,6 +102,8 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *
} else
LIST_APPEND(entries, list->entries, entry);
entry->list = list;
return TAKE_PTR(entry);
}