We can free 'def->name' directly. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/libxl/libxl_migration.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c index defdda5ed6..9d253346eb 100644 --- a/src/libxl/libxl_migration.c +++ b/src/libxl/libxl_migration.c @@ -449,7 +449,6 @@ libxlDomainMigrationDstPrepareDef(libxlDriverPrivatePtr driver, { libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver); virDomainDefPtr def; - char *name = NULL; if (!dom_xml) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -464,13 +463,12 @@ libxlDomainMigrationDstPrepareDef(libxlDriverPrivatePtr driver, goto cleanup; if (dname) { - name = def->name; + VIR_FREE(def->name); def->name = g_strdup(dname); } cleanup: virObjectUnref(cfg); - VIR_FREE(name); return def; } -- 2.26.2