From patchwork Thu Feb 23 10:48:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 9588159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8FD8F604A2 for ; Thu, 23 Feb 2017 10:51:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C35728609 for ; Thu, 23 Feb 2017 10:51:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 711F328695; Thu, 23 Feb 2017 10:51:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3143728609 for ; Thu, 23 Feb 2017 10:51:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgqxB-0005pv-5F; Thu, 23 Feb 2017 10:48:53 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgqx9-0005pc-Hl for xen-devel@lists.xen.org; Thu, 23 Feb 2017 10:48:51 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id 07/6E-16066-21EBEA85; Thu, 23 Feb 2017 10:48:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOIsWRWlGSWpSXmKPExsXilM8ioyu0b12 EwfYTYhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bnDfsZCx5yVsxe1MHewNjL0cXIxSEksIpR 4tCzZWxdjJxATrbE9nOzGEESLAKXmCU+z3zLBJKQEPCUuPV3NzOE7Sxxp+MbM0T3IUaJv39us YAk2ARCJdq3z2AFsUUEpCWufb4MNolZYC6jxOd/29hBEsICrhInZqwGm8QioCrxZO9EsDivgL /EhQ2HobbJSdw81wlWwykQIPGyr40V4jx/iYlTQc4DqReUODnzCdBiDqAF6hLr5wmBhPkFlCS 2rb8MVsIsIC/RvHU28wRG4VlIOmYhdMxCUrWAkXkVo0ZxalFZapGuobleUlFmekZJbmJmjq6h galebmpxcWJ6ak5iUrFecn7uJkZgoDMAwQ7Gi6c9DzFKcjApifL67FkXIcSXlJ9SmZFYnBFfV JqTWnyIUYaDQ0mCt2AvUE6wKDU9tSItMwcYczBpCQ4eJRHeXpBW3uKCxNzizHSI1ClGXY45s3 e/YRJiycvPS5US580BmSEAUpRRmgc3Ahb/lxhlpYR5GYGOEuIpSC3KzSxBlX/FKM7BqCTMexV kFU9mXgncpldARzABHWHpvBbkiJJEhJRUA+NmtsqQ5T6JUd+uLhE9U6lowR149b0/x7NXK6Qc twQ3XfjH52YfoLD2d9wTF17Wvr1PYp0qd948Or1yUsP31rUynd96mE8LivMtbHu5cVLjXgN2V ravPUumXbzYcJ41iTmII7lDI1koXcv23nwfr+pc/rRcveeHLTz50hYXv1P8N6fV/VzMdCWW4o xEQy3mouJEAE2GBBT6AgAA X-Env-Sender: marmarek@invisiblethingslab.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1487846929!70817748!1 X-Originating-IP: [66.111.4.28] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5389 invoked from network); 23 Feb 2017 10:48:50 -0000 Received: from out4-smtp.messagingengine.com (HELO out4-smtp.messagingengine.com) (66.111.4.28) by server-13.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 23 Feb 2017 10:48:50 -0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 4916220B1B; Thu, 23 Feb 2017 05:48:49 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Thu, 23 Feb 2017 05:48:49 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=7C8FJ67HS46HY5LeTp3IbSK0qRY=; b=eoiQAUh1LWMjzXfheFi7 epZkP+ij1QcJO9JIErmoe39wxVhxReFyQmzMHEmBYw2F/ix5i27kqvnd7FLUy4x0 XfU92+0JsGDIapDcTvl95AbNNwY8UxntpBiYVM95ieQuhfadBlkav8WC6x0tbE2x bUHXpANg+TiqolquVLlLvyc= X-ME-Sender: X-Sasl-enc: Xl9hoW7dJLWJN2/NKKIbGkhLTjnAXU4vAvSDmnQEOVx1 1487846928 Received: from devel-3rdparty.localdomain (89-70-103-23.dynamic.chello.pl [89.70.103.23]) by mail.messagingengine.com (Postfix) with ESMTPA id 4089524357; Thu, 23 Feb 2017 05:48:48 -0500 (EST) From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xen.org Date: Thu, 23 Feb 2017 11:48:21 +0100 Message-Id: <1487846908-21462-2-git-send-email-marmarek@invisiblethingslab.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487846908-21462-1-git-send-email-marmarek@invisiblethingslab.com> References: <1487846908-21462-1-git-send-email-marmarek@invisiblethingslab.com> MIME-Version: 1.0 Organization: Invisible Things Lab Cc: Wei Liu , Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Subject: [Xen-devel] [PATCH 1/8] python: check return value of PyErr_NewException X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Marek Marczykowski-Górecki --- tools/python/xen/lowlevel/xc/xc.c | 4 ++++ tools/python/xen/lowlevel/xs/xs.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 39be1d5..7fbead5 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -2735,6 +2735,10 @@ PyMODINIT_FUNC initxc(void) return; xc_error_obj = PyErr_NewException(PKG ".Error", PyExc_RuntimeError, NULL); + if (xc_error_obj == NULL) { + Py_DECREF(m); + return; + } zero = PyInt_FromLong(0); /* KAF: This ensures that we get debug output in a timely manner. */ diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c index a86edbe..5772f4b 100644 --- a/tools/python/xen/lowlevel/xs/xs.c +++ b/tools/python/xen/lowlevel/xs/xs.c @@ -987,6 +987,10 @@ PyMODINIT_FUNC initxs(void) return; xs_error = PyErr_NewException(PKG ".Error", PyExc_RuntimeError, NULL); + if (xs_error == NULL) { + Py_DECREF(m); + return; + } Py_INCREF(&xshandle_type); PyModule_AddObject(m, CLS, (PyObject *)&xshandle_type);