1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-26 03:21:44 +03:00

qemuMigrationSrcBegin: Automatically free 'xml' variable on error

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-04-29 14:31:43 +02:00
parent 4f6b1fbcfa
commit 49ef0f95c6

View File

@ -2487,7 +2487,7 @@ qemuMigrationSrcBegin(virConnectPtr conn,
{
virQEMUDriver *driver = conn->privateData;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
char *xml = NULL;
g_autofree char *xml = NULL;
virDomainAsyncJob asyncJob;
if (cfg->migrateTLSForce &&
@ -2532,10 +2532,8 @@ qemuMigrationSrcBegin(virConnectPtr conn,
* place.
*/
if (virCloseCallbacksSet(driver->closeCallbacks, vm, conn,
qemuMigrationSrcCleanup) < 0) {
VIR_FREE(xml);
qemuMigrationSrcCleanup) < 0)
goto endjob;
}
qemuMigrationJobContinue(vm);
} else {
goto endjob;
@ -2543,7 +2541,7 @@ qemuMigrationSrcBegin(virConnectPtr conn,
cleanup:
virDomainObjEndAPI(&vm);
return xml;
return g_steal_pointer(&xml);
endjob:
if (flags & VIR_MIGRATE_CHANGE_PROTECTION)