summaryrefslogtreecommitdiff
path: root/src/libudev
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-02-02 02:18:49 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-02-02 02:22:59 +0900
commit140716a51694ad2aa365869e3f8a741509a70959 (patch)
tree2419e7c553cc858a8ca9e75227c356f3a6d1de35 /src/libudev
parenteaef130d3fcb3c6a4d2feb50248ab3ac26f3e05b (diff)
downloadsystemd-140716a51694ad2aa365869e3f8a741509a70959.tar.gz
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.
Diffstat (limited to 'src/libudev')
-rw-r--r--src/libudev/libudev-list.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libudev/libudev-list.c b/src/libudev/libudev-list.c
index 514927bc8f..c224e9df6d 100644
--- a/src/libudev/libudev-list.c
+++ b/src/libudev/libudev-list.c
@@ -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);
}