libvirt/SOURCES/libvirt-qemuMigrationCookieAddNBD-Use-glib-memory-allocators.patch
2021-09-10 11:58:15 +00:00

48 lines
1.7 KiB
Diff

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