mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-18 05:28:36 -07:00
qemu-config: never call the callback after an error, fix leak
Ensure that the callback to qemu_config_foreach is never called upon
an error, by moving the invocation before the "out" label.
Cc: armbru@redhat.com
Fixes: 3770141139 ("qemu-config: parse configuration files to a QDict", 2021-06-04)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
143c2e0432
commit
e72f9524fe
1 changed files with 2 additions and 2 deletions
|
|
@ -417,12 +417,12 @@ static int qemu_config_foreach(FILE *fp, QEMUConfigCB *cb, void *opaque,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
res = count;
|
res = count;
|
||||||
out:
|
|
||||||
if (qdict) {
|
if (qdict) {
|
||||||
cb(group, qdict, opaque, errp);
|
cb(group, qdict, opaque, errp);
|
||||||
qobject_unref(qdict);
|
|
||||||
}
|
}
|
||||||
|
out:
|
||||||
loc_pop(&loc);
|
loc_pop(&loc);
|
||||||
|
qobject_unref(qdict);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue