From patchwork Mon Mar 3 17:12:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 325963 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 443172C00C1 for ; Tue, 4 Mar 2014 05:11:48 +1100 (EST) Received: from localhost ([::1]:41154 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKXL8-0000YS-0q for incoming@patchwork.ozlabs.org; Mon, 03 Mar 2014 13:11:46 -0500 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 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s23IB2oU018891 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 3 Mar 2014 13:11:06 -0500 Received: from localhost (ovpn-113-127.phx2.redhat.com [10.3.113.127]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s23HLkhi012215; Mon, 3 Mar 2014 12:21:46 -0500 From: Luiz Capitulino To: peter.maydell@linaro.org 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws Subject: [Qemu-devel] [PULL 32/32] qapi: Add missing null check to opts_start_struct() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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; }