[PATCH spice-gtk v2 16/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

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

 



Use g_free instead of free and g_clear_pointer.
Do not mix free and g_free, on some platform or with some settings
can be quite different function or heap.
---
 src/cd-scsi.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/cd-scsi.c b/src/cd-scsi.c
index bce7191b..66e4ddef 100644
--- a/src/cd-scsi.c
+++ b/src/cd-scsi.c
@@ -634,22 +634,10 @@ int cd_scsi_dev_unrealize(CdScsiTarget *st, uint32_t lun)
     }
     dev = &st->units[lun];
 
-    if (dev->vendor != NULL) {
-        free(dev->vendor);
-        dev->vendor = NULL;
-    }
-    if (dev->product != NULL) {
-        free(dev->product);
-        dev->product = NULL;
-    }
-    if (dev->version != NULL) {
-        free(dev->version);
-        dev->version = NULL;
-    }
-    if (dev->serial != NULL) {
-        free(dev->serial);
-        dev->serial = NULL;
-    }
+    g_clear_pointer(&dev->vendor, g_free);
+    g_clear_pointer(&dev->product, g_free);
+    g_clear_pointer(&dev->version, g_free);
+    g_clear_pointer(&dev->serial, g_free);
 
     dev->loaded = FALSE;
     dev->realized = FALSE;
-- 
2.20.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]