mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
Don't check qobject_type() before qobject_to_qdict()
qobject_to_qdict(obj) returns NULL when obj isn't a QDict. Check that instead of qobject_type(obj) == QTYPE_QDICT. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1487363905-9480-8-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
4b32e11a59
commit
ca6b6e1e68
6 changed files with 21 additions and 44 deletions
4
block.c
4
block.c
|
@ -1169,13 +1169,13 @@ static QDict *parse_json_filename(const char *filename, Error **errp)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (qobject_type(options_obj) != QTYPE_QDICT) {
|
||||
options = qobject_to_qdict(options_obj);
|
||||
if (!options) {
|
||||
qobject_decref(options_obj);
|
||||
error_setg(errp, "Invalid JSON object given");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
options = qobject_to_qdict(options_obj);
|
||||
qdict_flatten(options);
|
||||
|
||||
return options;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue