diff options
author | Markus Armbruster <armbru@redhat.com> | 2014-03-01 08:40:39 +0100 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2014-03-03 11:17:45 -0500 |
commit | b774539743c52ef605c6e2cbac19376c2757cb86 (patch) | |
tree | 5f5f8d35d87fb56ee91feb1ee06c5564cb5efe47 /qapi/opts-visitor.c | |
parent | 25a7017555f1b4aeb543b5d323ff4afb8f9c5437 (diff) |
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>
Diffstat (limited to 'qapi/opts-visitor.c')
-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; } |