mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-03 20:55:32 +00:00
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. Backports commit 58561c27669ddf1c6d39ff8ce25837c6f2d9d92c from qemu
This commit is contained in:
parent
fdf09c6d12
commit
a5cf19858d
|
@ -199,25 +199,21 @@ static void qobject_input_start_list(Visitor *v, const char *name,
|
||||||
QObject *qobj = qobject_input_get_object(qiv, name, true, errp);
|
QObject *qobj = qobject_input_get_object(qiv, name, true, errp);
|
||||||
const QListEntry *entry;
|
const QListEntry *entry;
|
||||||
|
|
||||||
|
if (list) {
|
||||||
|
*list = NULL;
|
||||||
|
}
|
||||||
if (!qobj) {
|
if (!qobj) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (qobject_type(qobj) != QTYPE_QLIST) {
|
if (qobject_type(qobj) != QTYPE_QLIST) {
|
||||||
if (list) {
|
|
||||||
*list = NULL;
|
|
||||||
}
|
|
||||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||||
"list");
|
"list");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = qobject_input_push(qiv, qobj, list);
|
entry = qobject_input_push(qiv, qobj, list);
|
||||||
if (list) {
|
if (entry && list) {
|
||||||
if (entry) {
|
*list = g_malloc0(size);
|
||||||
*list = g_malloc0(size);
|
|
||||||
} else {
|
|
||||||
*list = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue