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

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