]> err.no Git - systemd/commitdiff
libudev: accept NULL in udev_device_get_tags_list_entry()
authorKay Sievers <kay.sievers@vrfy.org>
Fri, 23 Apr 2010 07:22:42 +0000 (09:22 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Fri, 23 Apr 2010 07:22:42 +0000 (09:22 +0200)
libudev/libudev-device-private.c
libudev/libudev-device.c

index 7e5fcbc29375a1403c13e2cd893a21b01530afbf..8c8ac244be99e57006ccc0c58295d670cf80c612 100644 (file)
@@ -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);
index 3f441d099921da31a76382fa4a3351ec6c2764ee..a6a1ecb4e90f84651b26ea0c5cb345928bbeb082 100644 (file)
@@ -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);
 }