[PATCH 15/32] udevProcessFloppy; remove unnecessary allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 d7a49f8..46e48df 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -892,17 +892,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);
-- 
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]