render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
fbe740
From b3f938e7c0907ea9222827550fd3dfa0c1f1e1fd Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <b3f938e7c0907ea9222827550fd3dfa0c1f1e1fd@dist-git>
fbe740
From: Peter Krempa <pkrempa@redhat.com>
fbe740
Date: Tue, 4 Feb 2020 15:08:04 +0100
fbe740
Subject: [PATCH] qemuMigrationCookieAddNBD: Use glib memory allocators
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
fbe740
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
fbe740
(cherry picked from commit 8efeeb59a6e76fa9515deb7d3d26ae570e0fb7a7)
fbe740
fbe740
https://bugzilla.redhat.com/show_bug.cgi?id=1793263
fbe740
Message-Id: <5872c474b94250bb0994748d9b769883ecbea6f8.1580824112.git.pkrempa@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
---
fbe740
 src/qemu/qemu_migration_cookie.c | 6 ++----
fbe740
 1 file changed, 2 insertions(+), 4 deletions(-)
fbe740
fbe740
diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
fbe740
index 73ae815818..1c3de13983 100644
fbe740
--- a/src/qemu/qemu_migration_cookie.c
fbe740
+++ b/src/qemu/qemu_migration_cookie.c
fbe740
@@ -461,8 +461,7 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
fbe740
     /* It is not a bug if there already is a NBD data */
fbe740
     qemuMigrationCookieNBDFree(mig->nbd);
fbe740
 
fbe740
-    if (VIR_ALLOC(mig->nbd) < 0)
fbe740
-        return -1;
fbe740
+    mig->nbd = g_new0(qemuMigrationCookieNBD, 1);
fbe740
 
fbe740
     mig->nbd->port = priv->nbdPort;
fbe740
     mig->flags |= QEMU_MIGRATION_COOKIE_NBD;
fbe740
@@ -470,8 +469,7 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
fbe740
     if (vm->def->ndisks == 0)
fbe740
         return 0;
fbe740
 
fbe740
-    if (VIR_ALLOC_N(mig->nbd->disks, vm->def->ndisks) < 0)
fbe740
-        return -1;
fbe740
+    mig->nbd->disks = g_new0(struct qemuMigrationCookieNBDDisk, vm->def->ndisks);
fbe740
     mig->nbd->ndisks = 0;
fbe740
 
fbe740
     for (i = 0; i < vm->def->ndisks; i++) {
fbe740
-- 
fbe740
2.25.0
fbe740