[PATCH 03/30] qemuMigrationParamsResetTLS: Adapt to modern memory management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use g_autofree instead of VIR_FREE and delete the comment mentioning
possible failure to allocate memory.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_migration_params.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index a36c6a4aea..8c552ab9a0 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -1070,8 +1070,8 @@ qemuMigrationParamsResetTLS(virQEMUDriverPtr driver,
                             qemuMigrationParamsPtr origParams,
                             unsigned long apiFlags)
 {
-    char *tlsAlias = NULL;
-    char *secAlias = NULL;
+    g_autofree char *tlsAlias = NULL;
+    g_autofree char *secAlias = NULL;

     /* There's nothing to do if QEMU does not support TLS migration or we were
      * not asked to enable it. */
@@ -1079,17 +1079,11 @@ qemuMigrationParamsResetTLS(virQEMUDriverPtr driver,
         !(apiFlags & VIR_MIGRATE_TLS))
         return;

-    /* NB: If either or both fail to allocate memory we can still proceed
-     *     since the next time we migrate another deletion attempt will be
-     *     made after successfully generating the aliases. */
     tlsAlias = qemuAliasTLSObjFromSrcAlias(QEMU_MIGRATION_TLS_ALIAS_BASE);
     secAlias = qemuDomainGetSecretAESAlias(QEMU_MIGRATION_TLS_ALIAS_BASE, false);

     qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias);
     g_clear_pointer(&QEMU_DOMAIN_PRIVATE(vm)->migSecinfo, qemuDomainSecretInfoFree);
-
-    VIR_FREE(tlsAlias);
-    VIR_FREE(secAlias);
 }


-- 
2.24.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux