[libvirt] [PATCHv2 1/8] Remove VIR_STRDUP usage that sneaked in in the meantime

Ján Tomko jtomko at redhat.com
Wed Dec 11 13:23:17 UTC 2019


My hesitation to remove VIR_STRDUP without VIR_STRNDUP resulted
in these being able to sneak in.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/conf/backup_conf.c       | 4 +---
 src/qemu/qemu_monitor_json.c | 3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c
index 6be2e0498e..aa11967d2a 100644
--- a/src/conf/backup_conf.c
+++ b/src/conf/backup_conf.c
@@ -483,9 +483,7 @@ virDomainBackupAlignDisks(virDomainBackupDefPtr def,
             continue;
 
         backupdisk = &def->disks[ndisks++];
-
-        if (VIR_STRDUP(backupdisk->name, domdisk->dst) < 0)
-            return -1;
+        backupdisk->name = g_strdup(domdisk->dst);
 
         if (backup_all &&
             !virStorageSourceIsEmpty(domdisk->src) &&
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 00e1d3ce15..8a8347924a 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5564,8 +5564,7 @@ int qemuMonitorJSONGetMachines(qemuMonitorPtr mon,
                 goto cleanup;
             }
 
-            if (VIR_STRDUP(info->defaultCPU, tmp) < 0)
-                goto cleanup;
+            info->defaultCPU = g_strdup(tmp);
         }
     }
 
-- 
2.21.0




More information about the libvir-list mailing list