From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJeXZ-0004gA-4Z for qemu-devel@nongnu.org; Sat, 01 Mar 2014 02:41:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WJeXR-0000vM-Tr for qemu-devel@nongnu.org; Sat, 01 Mar 2014 02:40:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:6835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJeXR-0000v9-Ln for qemu-devel@nongnu.org; Sat, 01 Mar 2014 02:40:49 -0500 From: Markus Armbruster Date: Sat, 1 Mar 2014 08:40:39 +0100 Message-Id: <1393659639-12959-14-git-send-email-armbru@redhat.com> In-Reply-To: <1393659639-12959-1-git-send-email-armbru@redhat.com> References: <1393659639-12959-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v3 13/13] qapi: Add missing null check to opts_start_struct() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, mdroth@linux.vnet.ibm.com, lcapitulino@redhat.com, aliguori@amazon.com, pbonzini@redhat.com 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 Reviewed-by: Eric Blake --- qapi/opts-visitor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c index 96ed858..5d830a2 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; } -- 1.8.1.4