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>
This commit is contained in:
Markus Armbruster 2014-03-01 08:40:39 +01:00 committed by Luiz Capitulino
parent 25a7017555
commit b774539743

View File

@ -124,7 +124,9 @@ opts_start_struct(Visitor *v, void **obj, const char *kind,
OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, v); OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, v);
const QemuOpt *opt; const QemuOpt *opt;
*obj = g_malloc0(size > 0 ? size : 1); if (obj) {
*obj = g_malloc0(size > 0 ? size : 1);
}
if (ov->depth++ > 0) { if (ov->depth++ > 0) {
return; return;
} }