mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
qemuMigrationParamsResetTLS: Adapt to modern memory management
Use g_autofree instead of VIR_FREE and delete the comment mentioning possible failure to allocate memory. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
38bc76bcc1
commit
3b61106550
@ -1070,8 +1070,8 @@ qemuMigrationParamsResetTLS(virQEMUDriverPtr driver,
|
|||||||
qemuMigrationParamsPtr origParams,
|
qemuMigrationParamsPtr origParams,
|
||||||
unsigned long apiFlags)
|
unsigned long apiFlags)
|
||||||
{
|
{
|
||||||
char *tlsAlias = NULL;
|
g_autofree char *tlsAlias = NULL;
|
||||||
char *secAlias = NULL;
|
g_autofree char *secAlias = NULL;
|
||||||
|
|
||||||
/* There's nothing to do if QEMU does not support TLS migration or we were
|
/* There's nothing to do if QEMU does not support TLS migration or we were
|
||||||
* not asked to enable it. */
|
* not asked to enable it. */
|
||||||
@ -1079,17 +1079,11 @@ qemuMigrationParamsResetTLS(virQEMUDriverPtr driver,
|
|||||||
!(apiFlags & VIR_MIGRATE_TLS))
|
!(apiFlags & VIR_MIGRATE_TLS))
|
||||||
return;
|
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);
|
tlsAlias = qemuAliasTLSObjFromSrcAlias(QEMU_MIGRATION_TLS_ALIAS_BASE);
|
||||||
secAlias = qemuDomainGetSecretAESAlias(QEMU_MIGRATION_TLS_ALIAS_BASE, false);
|
secAlias = qemuDomainGetSecretAESAlias(QEMU_MIGRATION_TLS_ALIAS_BASE, false);
|
||||||
|
|
||||||
qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias);
|
qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias);
|
||||||
g_clear_pointer(&QEMU_DOMAIN_PRIVATE(vm)->migSecinfo, qemuDomainSecretInfoFree);
|
g_clear_pointer(&QEMU_DOMAIN_PRIVATE(vm)->migSecinfo, qemuDomainSecretInfoFree);
|
||||||
|
|
||||||
VIR_FREE(tlsAlias);
|
|
||||||
VIR_FREE(secAlias);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user