aboutsummaryrefslogtreecommitdiff
path: root/qapi/opts-visitor.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-03-03 13:32:36 +0100
committerMarkus Armbruster <armbru@redhat.com>2017-03-05 09:14:19 +0100
commitf332e830e38b3ff3953ef02ac04e409ae53769c5 (patch)
tree6b97a4198f04510aa7d12a3754a40fe9b99d185a /qapi/opts-visitor.c
parenta8aec6de2ac1a5e36989fdfba29067b361009b75 (diff)
downloadqemu-f332e830e38b3ff3953ef02ac04e409ae53769c5.zip
qemu-f332e830e38b3ff3953ef02ac04e409ae53769c5.tar.gz
qemu-f332e830e38b3ff3953ef02ac04e409ae53769c5.tar.bz2
qapi: Make string input and opts visitor require non-null input
The string input visitor tries to cope with null input. Null input isn't used anywhere, and isn't covered by tests. Unsurprisingly, it doesn't fully work: start_list() crashes because it passes the input via parse_str() to strtoll() unchecked. Make string_input_visitor_new() assert its argument isn't null, and drop the code trying to deal with null input. The opts visitor crashes when you try to actually visit something with null input. Make opts_visitor_new() assert its argument isn't null, mostly for clarity. qobject_input_visitor_new() already asserts its argument isn't null. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1488544368-30622-17-git-send-email-armbru@redhat.com>
Diffstat (limited to 'qapi/opts-visitor.c')
-rw-r--r--qapi/opts-visitor.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c
index a0a7c0e..c50dc4b 100644
--- a/qapi/opts-visitor.c
+++ b/qapi/opts-visitor.c
@@ -528,6 +528,7 @@ opts_visitor_new(const QemuOpts *opts)
{
OptsVisitor *ov;
+ assert(opts);
ov = g_malloc0(sizeof *ov);
ov->visitor.type = VISITOR_INPUT;