render / rpms / libvirt

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