mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
libudev: device - free values before updating them
This commit is contained in:
parent
804ab68550
commit
a71369b0db
@ -1282,6 +1282,7 @@ const char *udev_device_get_devpath_old(struct udev_device *udev_device)
|
|||||||
|
|
||||||
int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old)
|
int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old)
|
||||||
{
|
{
|
||||||
|
free(udev_device->devpath_old);
|
||||||
udev_device->devpath_old = strdup(devpath_old);
|
udev_device->devpath_old = strdup(devpath_old);
|
||||||
if (udev_device->devpath_old == NULL)
|
if (udev_device->devpath_old == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -1296,6 +1297,7 @@ const char *udev_device_get_knodename(struct udev_device *udev_device)
|
|||||||
|
|
||||||
int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename)
|
int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename)
|
||||||
{
|
{
|
||||||
|
free(udev_device->knodename);
|
||||||
udev_device->knodename = strdup(knodename);
|
udev_device->knodename = strdup(knodename);
|
||||||
if (udev_device->knodename == NULL)
|
if (udev_device->knodename == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
Loading…
Reference in New Issue
Block a user