machine: Use g_autoptr in machine_set_smp

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2021-10-01 19:04:03 +02:00
parent 2b52619994
commit e7f944bb94
1 changed files with 2 additions and 5 deletions

View File

@ -897,7 +897,7 @@ static void machine_set_smp(Object *obj, Visitor *v, const char *name,
{ {
MachineClass *mc = MACHINE_GET_CLASS(obj); MachineClass *mc = MACHINE_GET_CLASS(obj);
MachineState *ms = MACHINE(obj); MachineState *ms = MACHINE(obj);
SMPConfiguration *config; g_autoptr(SMPConfiguration) config = NULL;
ERRP_GUARD(); ERRP_GUARD();
if (!visit_type_SMPConfiguration(v, name, &config, errp)) { if (!visit_type_SMPConfiguration(v, name, &config, errp)) {
@ -920,7 +920,7 @@ static void machine_set_smp(Object *obj, Visitor *v, const char *name,
smp_parse(ms, config, errp); smp_parse(ms, config, errp);
if (*errp) { if (*errp) {
goto out_free; return;
} }
/* sanity-check smp_cpus and max_cpus against mc */ /* sanity-check smp_cpus and max_cpus against mc */
@ -935,9 +935,6 @@ static void machine_set_smp(Object *obj, Visitor *v, const char *name,
ms->smp.max_cpus, ms->smp.max_cpus,
mc->name, mc->max_cpus); mc->name, mc->max_cpus);
} }
out_free:
qapi_free_SMPConfiguration(config);
} }
static void machine_class_init(ObjectClass *oc, void *data) static void machine_class_init(ObjectClass *oc, void *data)