summaryrefslogtreecommitdiffstats
path: root/src/libudev
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-11-22 15:46:43 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-11-22 15:50:02 +0100
commit3f14e7217a7fc9f8a7d18e2f1ea673feb808d1db (patch)
tree0f8583d21dd02ce9e3c13fab9c3d9c2018eb5e22 /src/libudev
parentlibudev: introduce return_with_errno() and use it where applicable (diff)
downloadsystemd-3f14e7217a7fc9f8a7d18e2f1ea673feb808d1db.tar.xz
systemd-3f14e7217a7fc9f8a7d18e2f1ea673feb808d1db.zip
libudev: do not ignore error in udev_list_entry_add()
Diffstat (limited to 'src/libudev')
-rw-r--r--src/libudev/libudev-device.c12
-rw-r--r--src/libudev/libudev-enumerate.c3
2 files changed, 10 insertions, 5 deletions
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index 4077b607b3..19695b5ee4 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -601,7 +601,8 @@ _public_ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev
udev_list_cleanup(&udev_device->devlinks);
FOREACH_DEVICE_DEVLINK(udev_device->device, devlink)
- udev_list_entry_add(&udev_device->devlinks, devlink, NULL);
+ if (!udev_list_entry_add(&udev_device->devlinks, devlink, NULL))
+ return_with_errno(NULL, ENOMEM);
udev_device->devlinks_read = true;
udev_device->devlinks_generation = device_get_devlinks_generation(udev_device->device);
@@ -632,7 +633,8 @@ _public_ struct udev_list_entry *udev_device_get_properties_list_entry(struct ud
udev_list_cleanup(&udev_device->properties);
FOREACH_DEVICE_PROPERTY(udev_device->device, key, value)
- udev_list_entry_add(&udev_device->properties, key, value);
+ if (!udev_list_entry_add(&udev_device->properties, key, value))
+ return_with_errno(NULL, ENOMEM);
udev_device->properties_read = true;
udev_device->properties_generation = device_get_properties_generation(udev_device->device);
@@ -755,7 +757,8 @@ _public_ struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_
udev_list_cleanup(&udev_device->sysattrs);
FOREACH_DEVICE_SYSATTR(udev_device->device, sysattr)
- udev_list_entry_add(&udev_device->sysattrs, sysattr, NULL);
+ if (!udev_list_entry_add(&udev_device->sysattrs, sysattr, NULL))
+ return_with_errno(NULL, ENOMEM);
udev_device->sysattrs_read = true;
}
@@ -809,7 +812,8 @@ _public_ struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_dev
udev_list_cleanup(&udev_device->tags);
FOREACH_DEVICE_TAG(udev_device->device, tag)
- udev_list_entry_add(&udev_device->tags, tag, NULL);
+ if (!udev_list_entry_add(&udev_device->tags, tag, NULL))
+ return_with_errno(NULL, ENOMEM);
udev_device->tags_read = true;
udev_device->tags_generation = device_get_tags_generation(udev_device->device);
diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c
index 34ecdbec17..e54ee572c5 100644
--- a/src/libudev/libudev-enumerate.c
+++ b/src/libudev/libudev-enumerate.c
@@ -144,7 +144,8 @@ _public_ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enume
if (r < 0)
return_with_errno(NULL, r);
- udev_list_entry_add(&udev_enumerate->devices_list, syspath, NULL);
+ if (!udev_list_entry_add(&udev_enumerate->devices_list, syspath, NULL))
+ return_with_errno(NULL, ENOMEM);
}
udev_enumerate->devices_uptodate = true;