From patchwork Tue Oct 8 10:36:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Majunath Goudar X-Patchwork-Id: 3009431 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 AC3D7BF924 for ; Wed, 9 Oct 2013 15:29:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 880C020254 for ; Wed, 9 Oct 2013 15:29:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 869B320117 for ; Wed, 9 Oct 2013 15:28:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7DB28E7E04 for ; Wed, 9 Oct 2013 08:28:55 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 2DFC9E5EDD for ; Tue, 8 Oct 2013 03:36:22 -0700 (PDT) Received: by mail-pd0-f177.google.com with SMTP id y10so8500554pdj.22 for ; Tue, 08 Oct 2013 03:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=xuym+bRiZSnxMHcY1zhaw4J/p5Ajg7wyrdTsn4fJU48=; b=i8V4GWM8E5RvVjRWTxAhbKXXBRRu90mF5ZbqhBmNuqjXMjfbcd0OJSXRVYBrotOHAu zj3vT/3Q9wgC0Tk+uwjtT2N+XgUqUHyz//MgWsg41b9D1vwOY4Q6foy+ytx3BMDRXObl fpKnXXWAVcATJaThOmXiCzcBdRYJWAY702m3hUz4HNVRItDBjsIowhbiFOYsH8qa3xET +NMGdABs5Mu5XyqU1zeai8wKnO2fnpLoz0eVXPj2Tc0myZr1dhNHbOw4grqjpg7t+n4g B1hoMW+Q6ipX413/isJdFVCmv0eLMxbZPZdMBR+mm3HFwp01sbozRvUHkNXN5+n2/J8f ISlA== X-Received: by 10.68.189.163 with SMTP id gj3mr1125630pbc.102.1381228582065; Tue, 08 Oct 2013 03:36:22 -0700 (PDT) Received: from manjunath-Latitude-E6420.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPSA id ef10sm46349856pac.1.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Oct 2013 03:36:21 -0700 (PDT) From: Majunath Goudar To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] DRM: TTM: Fix memory leak issue in ttm_agp_tt_create(). Date: Tue, 8 Oct 2013 16:06:04 +0530 Message-Id: <1381228565-20846-1-git-send-email-csmanjuvijay@gmail.com> X-Mailer: git-send-email 1.7.9.5 X-Mailman-Approved-At: Wed, 09 Oct 2013 08:23:48 -0700 Cc: Jeyaraman R , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, David Howells , Majunath Goudar , Dave Airlie , Dave Jones , nataraja.km@lge.com, "Paul E. McKenney" , Thomas Gleixner X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 This patch adds kfree() in ttm_agp_tt_create() to avoide the memory leak, without this there is a chance of memory leak in ttm_tt_init() fail case. Signed-off-by: Jeyaraman R Signed-off-by: Manjunath Goudar Cc: David Airlie Cc: "Paul E. McKenney" Cc: David Howells Cc: Thomas Gleixner Cc: Dave Jones Cc: Dave Airlie Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org --- drivers/gpu/drm/ttm/ttm_agp_backend.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/ttm/ttm_agp_backend.c b/drivers/gpu/drm/ttm/ttm_agp_backend.c index 3302f99..764be36 100644 --- a/drivers/gpu/drm/ttm/ttm_agp_backend.c +++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c @@ -126,6 +126,7 @@ struct ttm_tt *ttm_agp_tt_create(struct ttm_bo_device *bdev, agp_be->ttm.func = &ttm_agp_func; if (ttm_tt_init(&agp_be->ttm, bdev, size, page_flags, dummy_read_page)) { + kfree(agp_be); return NULL; }