From patchwork Wed Sep 5 18:58:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 181938 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9697D2C0083 for ; Thu, 6 Sep 2012 05:58:21 +1000 (EST) Received: from localhost ([::1]:43414 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9Koj-0003bt-I0 for incoming@patchwork.ozlabs.org; Wed, 05 Sep 2012 14:59:13 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9Kns-0002E2-Bq for qemu-devel@nongnu.org; Wed, 05 Sep 2012 14:58:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9Knr-0001dz-9b for qemu-devel@nongnu.org; Wed, 05 Sep 2012 14:58:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1879) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9Knr-0001do-1j for qemu-devel@nongnu.org; Wed, 05 Sep 2012 14:58:19 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q85IwIig020229 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 5 Sep 2012 14:58:18 -0400 Received: from localhost (ovpn-113-54.phx2.redhat.com [10.3.113.54]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q85IwH1J005605; Wed, 5 Sep 2012 14:58:17 -0400 From: Luiz Capitulino To: aliguori@us.ibm.com Date: Wed, 5 Sep 2012 15:58:37 -0300 Message-Id: <1346871526-25342-11-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1346871526-25342-1-git-send-email-lcapitulino@redhat.com> References: <1346871526-25342-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Stefan Weil , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 10/19] json-parser: Fix potential NULL pointer segfault 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: Stefan Weil Report from smatch: json-parser.c:474 parse_object(62) error: potential null derefence 'dict'. json-parser.c:553 parse_array(75) error: potential null derefence 'list'. Label 'out' in json-parser.c can be called with list == NULL which is passed to QDECREF. Modify QDECREF to handle a NULL argument (inline function qobject_decref already handles them, too). Signed-off-by: Stefan Weil Signed-off-by: Luiz Capitulino --- qobject.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qobject.h b/qobject.h index d42386d..9124649 100644 --- a/qobject.h +++ b/qobject.h @@ -71,7 +71,7 @@ typedef struct QObject { /* High-level interface for qobject_decref() */ #define QDECREF(obj) \ - qobject_decref(QOBJECT(obj)) + qobject_decref(obj ? QOBJECT(obj) : NULL) /* Initialize an object to default values */ #define QOBJECT_INIT(obj, qtype_type) \