From patchwork Wed Jun 18 19:57:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 4379871 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 10D8ABEECB for ; Wed, 18 Jun 2014 23:41:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5EB3520380 for ; Wed, 18 Jun 2014 23:41:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 584C120034 for ; Wed, 18 Jun 2014 23:41:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 52EBAA538; Wed, 18 Jun 2014 16:41:01 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by gabe.freedesktop.org (Postfix) with ESMTP id A2E9D6E0AF for ; Wed, 18 Jun 2014 12:58:15 -0700 (PDT) Received: from localhost.localdomain ([37.24.9.232]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0Lbujs-1WGHUE1b0O-00jICk; Wed, 18 Jun 2014 21:58:10 +0200 From: Heinrich Schuchardt To: David Airlie Subject: [PATCH] drm/nouveau: avoid memory leak Date: Wed, 18 Jun 2014 21:57:47 +0200 Message-Id: <1403121467-27309-1-git-send-email-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.0.0 X-Provags-ID: V03:K0:Ou4Yacg9aG4yRiAVHsMWtzdXU7doC4bfyH7Y8dVBTHjo0QoyTNs GyzV/ruA0X6DjdGr6k5ny00/vjUOXT3p6J2TpO3JA2Jqm9y7NOtY+ePcwUqn9nPrJUBuVwM c2XZ716g2zmNpRG8K7QesRnzTdyEhUhdUrTdTUB4P7RqQRtl4mZku+Vxw8N+2DXQXwtMKkk X6nCzz3afuj52mMBVDVIQ== X-Mailman-Approved-At: Wed, 18 Jun 2014 16:40:54 -0700 Cc: Heinrich Schuchardt , Ben Skeggs , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If ttm_dma_tt_init fails memory is leaked. Signed-off-by: Heinrich Schuchardt --- drivers/gpu/drm/nouveau/nouveau_sgdma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index a4d22e5..23d880b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c @@ -109,7 +109,9 @@ nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev, else nvbe->ttm.ttm.func = &nv50_sgdma_backend; - if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page)) + if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page)) { + kfree(nvbe); return NULL; + } return &nvbe->ttm.ttm; }