From df7291c31c80380bdbe2fed5d7c6615274cd4c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 3 Jun 2016 15:51:28 +0200 Subject: [PATCH] udevProcessFloppy; remove unnecessary allocation Use udevHasDeviceProperty instead of udevGetStringProperty. We do not need to copy the string since we do not need it. Also add braces around the if body, since the change made syntax check complain. --- src/node_device/node_device_udev.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index fffd271996..6a3b2a2d6a 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -891,17 +891,14 @@ static int udevProcessFloppy(struct udev_device *device, { int tmp_int = 0; int has_media = 0; - char *tmp_str = NULL; if ((udevGetIntProperty(device, "DKD_MEDIA_AVAILABLE", - &tmp_int, 0) == PROPERTY_FOUND)) + &tmp_int, 0) == PROPERTY_FOUND)) { /* USB floppy */ has_media = tmp_int; - else if (udevGetStringProperty(device, "ID_FS_LABEL", - &tmp_str) == PROPERTY_FOUND) { + } else if (udevHasDeviceProperty(device, "ID_FS_LABEL")) { /* Legacy floppy */ has_media = 1; - VIR_FREE(tmp_str); } return udevProcessRemoveableMedia(device, def, has_media); -- GitLab