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