Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- src/cpu/cpu_x86.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index a65215caed..16e73b5b98 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3113,7 +3113,7 @@ x86FeatureFilterMigratable(const char *name, static virCPUDefPtr virCPUx86CopyMigratable(virCPUDefPtr cpu) { - virCPUDefPtr copy; + g_autoptr(virCPUDef) copy = NULL; virCPUx86MapPtr map; if (!(map = virCPUx86GetMap())) @@ -3124,13 +3124,9 @@ virCPUx86CopyMigratable(virCPUDefPtr cpu) if (virCPUDefCopyModelFilter(copy, cpu, false, x86FeatureFilterMigratable, map) < 0) - goto error; - - return copy; + return NULL; - error: - virCPUDefFree(copy); - return NULL; + return g_steal_pointer(©); } -- 2.26.0