qemu-config: Use ERRP_GUARD() where obviously appropriate

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221121085054.683122-8-armbru@redhat.com>
This commit is contained in:
Markus Armbruster 2022-11-21 09:50:51 +01:00
parent f766e6dc6a
commit 0a3090b1d2
1 changed files with 3 additions and 4 deletions

View File

@ -318,9 +318,9 @@ void qemu_add_opts(QemuOptsList *list)
static int qemu_config_foreach(FILE *fp, QEMUConfigCB *cb, void *opaque, static int qemu_config_foreach(FILE *fp, QEMUConfigCB *cb, void *opaque,
const char *fname, Error **errp) const char *fname, Error **errp)
{ {
ERRP_GUARD();
char line[1024], prev_group[64], group[64], arg[64], value[1024]; char line[1024], prev_group[64], group[64], arg[64], value[1024];
Location loc; Location loc;
Error *local_err = NULL;
QDict *qdict = NULL; QDict *qdict = NULL;
int res = -EINVAL, lno = 0; int res = -EINVAL, lno = 0;
int count = 0; int count = 0;
@ -348,10 +348,9 @@ static int qemu_config_foreach(FILE *fp, QEMUConfigCB *cb, void *opaque,
} }
if (qdict != prev) { if (qdict != prev) {
if (prev) { if (prev) {
cb(prev_group, prev, opaque, &local_err); cb(prev_group, prev, opaque, errp);
qobject_unref(prev); qobject_unref(prev);
if (local_err) { if (*errp) {
error_propagate(errp, local_err);
goto out; goto out;
} }
} }