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

Submitted by Frediano Ziglio on Aug. 9, 2019, 2:26 p.m.

Details

Message ID 20190809142651.2967-17-fziglio@redhat.com
State Superseded
Headers show
Series "CD emulation follow ups" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Aug. 9, 2019, 2:26 p.m.
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(-)

Patch hide | download patch | download mbox

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;