aboutsummaryrefslogtreecommitdiff
path: root/qapi/qobject-input-visitor.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-03-03 13:32:33 +0100
committerMarkus Armbruster <armbru@redhat.com>2017-03-05 09:14:19 +0100
commit58561c27669ddf1c6d39ff8ce25837c6f2d9d92c (patch)
tree72a7c7d472374cfb994cc9e2dd79484168eea744 /qapi/qobject-input-visitor.c
parentb8874fbfd329b5084463bcacd1418d493a93c383 (diff)
qapi: Make QObject input visitor set *list reliably
qobject_input_start_struct() sets *list, except when it fails because qobject_input_get_object() fails, i.e. the input object doesn't exist. All the other input visitor start_struct(), start_list(), start_alternate() always set *obj / *list. Change qobject_input_start_struct() to match. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1488544368-30622-14-git-send-email-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'qapi/qobject-input-visitor.c')
-rw-r--r--qapi/qobject-input-visitor.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c
index 2c2f88338f..d58696c7df 100644
--- a/qapi/qobject-input-visitor.c
+++ b/qapi/qobject-input-visitor.c
@@ -196,25 +196,21 @@ static void qobject_input_start_list(Visitor *v, const char *name,
QObject *qobj = qobject_input_get_object(qiv, name, true, errp);
const QListEntry *entry;
+ if (list) {
+ *list = NULL;
+ }
if (!qobj) {
return;
}
if (qobject_type(qobj) != QTYPE_QLIST) {
- if (list) {
- *list = NULL;
- }
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
"list");
return;
}
entry = qobject_input_push(qiv, qobj, list);
- if (list) {
- if (entry) {
- *list = g_malloc0(size);
- } else {
- *list = NULL;
- }
+ if (entry && list) {
+ *list = g_malloc0(size);
}
}