[Spice-devel] [PATCH spice-gtk v2 16/33] fixup! usb-redir: add files for SCSI and USB MSC implementation
Frediano Ziglio
fziglio at redhat.com
Fri Aug 9 14:26:34 UTC 2019
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
More information about the Spice-devel
mailing list