aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2021-07-05 19:14:37 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2021-07-20 17:06:28 +0200
commite72f9524febb78ee5ae2a201245cd7b1fb97ad08 (patch)
tree9a7d567e76bcd730cf1636f5f67d32f2a370442c /util
parent143c2e0432859826c9e8d5b2baa307355f1a5332 (diff)
downloadqemu-e72f9524febb78ee5ae2a201245cd7b1fb97ad08.zip
qemu-e72f9524febb78ee5ae2a201245cd7b1fb97ad08.tar.gz
qemu-e72f9524febb78ee5ae2a201245cd7b1fb97ad08.tar.bz2
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>
Diffstat (limited to 'util')
-rw-r--r--util/qemu-config.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/qemu-config.c b/util/qemu-config.c
index 84ee6dc..7db810f 100644
--- a/util/qemu-config.c
+++ b/util/qemu-config.c
@@ -417,12 +417,12 @@ static int qemu_config_foreach(FILE *fp, QEMUConfigCB *cb, void *opaque,
return res;
}
res = count;
-out:
if (qdict) {
cb(group, qdict, opaque, errp);
- qobject_unref(qdict);
}
+out:
loc_pop(&loc);
+ qobject_unref(qdict);
return res;
}