[libvirt] [PATCH] node_device: udev: Fix memory leak

We are setting the same property two different ways without free'ing in between. Just drop the second assignment. Signed-off-by: Cole Robinson <crobinso@redhat.com> --- src/node_device/node_device_udev.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index a9e196d..ff6bd46 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -997,11 +997,7 @@ static int udevProcessStorage(struct udev_device *device, goto out; } data->storage.block = strdup(devnode); - if (udevGetStringProperty(device, - "DEVNAME", - &data->storage.block) == PROPERTY_ERROR) { - goto out; - } + if (udevGetStringProperty(device, "ID_BUS", &data->storage.bus) == PROPERTY_ERROR) { -- 1.6.5.2

On 01/12/2010 03:26 PM, Cole Robinson wrote:
We are setting the same property two different ways without free'ing in between. Just drop the second assignment.
Signed-off-by: Cole Robinson<crobinso@redhat.com> --- src/node_device/node_device_udev.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index a9e196d..ff6bd46 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -997,11 +997,7 @@ static int udevProcessStorage(struct udev_device *device, goto out; } data->storage.block = strdup(devnode); - if (udevGetStringProperty(device, - "DEVNAME", -&data->storage.block) == PROPERTY_ERROR) { - goto out; - } + if (udevGetStringProperty(device, "ID_BUS", &data->storage.bus) == PROPERTY_ERROR) {
Good catch. ACK. Dave

On Tue, Jan 12, 2010 at 03:26:31PM -0500, Cole Robinson wrote:
We are setting the same property two different ways without free'ing in between. Just drop the second assignment.
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- src/node_device/node_device_udev.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index a9e196d..ff6bd46 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -997,11 +997,7 @@ static int udevProcessStorage(struct udev_device *device, goto out; } data->storage.block = strdup(devnode); - if (udevGetStringProperty(device, - "DEVNAME", - &data->storage.block) == PROPERTY_ERROR) { - goto out; - } + if (udevGetStringProperty(device, "ID_BUS", &data->storage.bus) == PROPERTY_ERROR) {
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On 01/12/2010 03:26 PM, Cole Robinson wrote:
We are setting the same property two different ways without free'ing in between. Just drop the second assignment.
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- src/node_device/node_device_udev.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index a9e196d..ff6bd46 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -997,11 +997,7 @@ static int udevProcessStorage(struct udev_device *device, goto out; } data->storage.block = strdup(devnode); - if (udevGetStringProperty(device, - "DEVNAME", - &data->storage.block) == PROPERTY_ERROR) { - goto out; - } + if (udevGetStringProperty(device, "ID_BUS", &data->storage.bus) == PROPERTY_ERROR) {
Pushed now. - Cole
participants (3)
-
Cole Robinson
-
Daniel P. Berrange
-
Dave Allan