Blame SOURCES/libvirt-qemuMigrationParamsResetTLS-Adapt-to-modern-memory-management.patch

d76c62
From f3179ed39f95ec25c9d4c6ec8ef67d54abd6c5ad Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <f3179ed39f95ec25c9d4c6ec8ef67d54abd6c5ad@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Mon, 16 Mar 2020 22:11:42 +0100
d76c62
Subject: [PATCH] qemuMigrationParamsResetTLS: Adapt to modern memory
d76c62
 management
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
Use g_autofree instead of VIR_FREE and delete the comment mentioning
d76c62
possible failure to allocate memory.
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
(cherry picked from commit 3b6110655013e9ae0ee933406c1ff0c7af2d4734)
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1804750
d76c62
Message-Id: <86a9b24e53e4de2830c6ff33639837b14f20d282.1584391726.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_migration_params.c | 10 ++--------
d76c62
 1 file changed, 2 insertions(+), 8 deletions(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
d76c62
index f61796713f..60b41e287a 100644
d76c62
--- a/src/qemu/qemu_migration_params.c
d76c62
+++ b/src/qemu/qemu_migration_params.c
d76c62
@@ -1074,8 +1074,8 @@ qemuMigrationParamsResetTLS(virQEMUDriverPtr driver,
d76c62
                             qemuMigrationParamsPtr origParams,
d76c62
                             unsigned long apiFlags)
d76c62
 {
d76c62
-    char *tlsAlias = NULL;
d76c62
-    char *secAlias = NULL;
d76c62
+    g_autofree char *tlsAlias = NULL;
d76c62
+    g_autofree char *secAlias = NULL;
d76c62
 
d76c62
     /* There's nothing to do if QEMU does not support TLS migration or we were
d76c62
      * not asked to enable it. */
d76c62
@@ -1083,17 +1083,11 @@ qemuMigrationParamsResetTLS(virQEMUDriverPtr driver,
d76c62
         !(apiFlags & VIR_MIGRATE_TLS))
d76c62
         return;
d76c62
 
d76c62
-    /* NB: If either or both fail to allocate memory we can still proceed
d76c62
-     *     since the next time we migrate another deletion attempt will be
d76c62
-     *     made after successfully generating the aliases. */
d76c62
     tlsAlias = qemuAliasTLSObjFromSrcAlias(QEMU_MIGRATION_TLS_ALIAS_BASE);
d76c62
     secAlias = qemuDomainGetSecretAESAlias(QEMU_MIGRATION_TLS_ALIAS_BASE, false);
d76c62
 
d76c62
     qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias);
d76c62
     g_clear_pointer(&QEMU_DOMAIN_PRIVATE(vm)->migSecinfo, qemuDomainSecretInfoFree);
d76c62
-
d76c62
-    VIR_FREE(tlsAlias);
d76c62
-    VIR_FREE(secAlias);
d76c62
 }
d76c62
 
d76c62
 
d76c62
-- 
d76c62
2.25.1
d76c62