Received: from eggs.gnu.org ([2001:4830:134:3::10]:60030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKXKe-0008GU-NI for qemu-devel@nongnu.org; Mon, 03 Mar 2014 13:11:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKXKY-0005Mo-KN for qemu-devel@nongnu.org; Mon, 03 Mar 2014 13:11:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKXKY-0005Mh-C1 for qemu-devel@nongnu.org; Mon, 03 Mar 2014 13:11:10 -0500 From: Luiz Capitulino Date: Mon, 3 Mar 2014 12:12:23 -0500 Message-Id: <1393866743-17385-33-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1393866743-17385-1-git-send-email-lcapitulino@redhat.com> References: <1393866743-17385-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PULL 32/32] qapi: Add missing null check to opts_start_struct() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws From: Markus Armbruster 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 Signed-off-by: Luiz Capitulino --- 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