From 65f099c721fa568350f8ac019e3a99fda1966082 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Apr 2010 09:22:42 +0200 Subject: [PATCH] libudev: accept NULL in udev_device_get_tags_list_entry() --- libudev/libudev-device-private.c | 2 +- libudev/libudev-device.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 7e5fcbc2..8c8ac244 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -51,7 +51,7 @@ int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, struct udev_list_entry *list_entry; bool found; - if (add) { + if (add && dev_old != NULL) { /* delete possible left-over tags */ udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(dev_old)) { const char *tag_old = udev_list_entry_get_name(list_entry); diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 3f441d09..a6a1ecb4 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1289,6 +1289,8 @@ void udev_device_cleanup_tags_list(struct udev_device *udev_device) struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device) { + if (udev_device == NULL) + return NULL; return udev_list_get_entry(&udev_device->tags_list); } -- 2.39.5