From: Kirill Shchetiniuk <[email protected]>
Signed-off-by: Kirill Shchetiniuk <[email protected]>
---
src/qemu/qemu_migration.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index d8c5f57d90..de7b6a8abf 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -4034,7 +4034,7 @@ qemuMigrationAnyPrepareDef(virQEMUDriver *driver,
int (*ensureACL)(virConnectPtr, virDomainDef *))
{
virDomainDef *def;
- char *name = NULL;
+ g_autofree char *name = NULL;
if (!dom_xml) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -4063,18 +4063,16 @@ qemuMigrationAnyPrepareDef(virQEMUDriver *driver,
if (!(def = virDomainDefParseString(dom_xml, driver->xmlopt,
qemuCaps,
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
- goto cleanup;
+ return NULL;
if (dname) {
name = def->name;
def->name = g_strdup(dname);
}
- cleanup:
- if (def && origname)
- *origname = name;
- else
- VIR_FREE(name);
+ if (origname)
+ *origname = g_steal_pointer(&name);
+
return def;
}
--
2.49.0