summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-07-08 02:02:40 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-07-08 02:02:40 +0200
commita71369b0db359cddeb207a317588b175630dcca8 (patch)
treea0970bad2b5a2def4982072d53d8744df350e121
parent804ab68550c5779a0a27b1ad2636184520f2a1cb (diff)
libudev: device - free values before updating them
-rw-r--r--libudev/libudev-device.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c
index cbbddaeff0..9d1e546c83 100644
--- a/libudev/libudev-device.c
+++ b/libudev/libudev-device.c
@@ -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)
{
+ free(udev_device->devpath_old);
udev_device->devpath_old = strdup(devpath_old);
if (udev_device->devpath_old == NULL)
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)
{
+ free(udev_device->knodename);
udev_device->knodename = strdup(knodename);
if (udev_device->knodename == NULL)
return -ENOMEM;