diff options
author | Markus Armbruster | 2014-03-01 08:40:39 +0100 |
---|---|---|
committer | Luiz Capitulino | 2014-03-03 17:17:45 +0100 |
commit | b774539743c52ef605c6e2cbac19376c2757cb86 (patch) | |
tree | 5f5f8d35d87fb56ee91feb1ee06c5564cb5efe47 | |
parent | qapi: Clean up superfluous null check in qapi_dealloc_type_str() (diff) | |
download | qemu-b774539743c52ef605c6e2cbac19376c2757cb86.tar.gz qemu-b774539743c52ef605c6e2cbac19376c2757cb86.tar.xz qemu-b774539743c52ef605c6e2cbac19376c2757cb86.zip |
qapi: Add missing null check to opts_start_struct()
Argument is null when visiting an unboxed struct. I can't see such a
visit in the current code. Fix it anyway.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
-rw-r--r-- | qapi/opts-visitor.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c index 96ed85899d..5d830a2b56 100644 --- a/qapi/opts-visitor.c +++ b/qapi/opts-visitor.c @@ -124,7 +124,9 @@ opts_start_struct(Visitor *v, void **obj, const char *kind, OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, v); const QemuOpt *opt; - *obj = g_malloc0(size > 0 ? size : 1); + if (obj) { + *obj = g_malloc0(size > 0 ? size : 1); + } if (ov->depth++ > 0) { return; } |