Commit b7745397 authored by Markus Armbruster's avatar Markus Armbruster Committed by Luiz Capitulino
Browse files

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: default avatarMarkus Armbruster <armbru@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Signed-off-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
parent 25a70175
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -124,7 +124,9 @@ opts_start_struct(Visitor *v, void **obj, const char *kind,
    OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, v);
    const QemuOpt *opt;

    if (obj) {
        *obj = g_malloc0(size > 0 ? size : 1);
    }
    if (ov->depth++ > 0) {
        return;
    }