From patchwork Fri May 21 06:15:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: manjugk manjugk X-Patchwork-Id: 101295 X-Patchwork-Delegate: hiroshi.doyu@nokia.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4L6FhjN027881 for ; Fri, 21 May 2010 06:15:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933436Ab0EUGPk (ORCPT ); Fri, 21 May 2010 02:15:40 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:42789 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932322Ab0EUGPi (ORCPT ); Fri, 21 May 2010 02:15:38 -0400 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o4L6FXHs002456 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 21 May 2010 01:15:36 -0500 Received: from localhost.localdomain (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o4L6FVW3020572; Fri, 21 May 2010 11:45:32 +0530 (IST) From: Manjunatha GK To: linux-omap@vger.kernel.org Cc: Satish , Tony Lindgren , vimal singh Subject: [PATCH v2] OMAP: Fix Memory leak Date: Fri, 21 May 2010 11:45:00 +0530 Message-Id: <1274422500-29955-1-git-send-email-manjugk@ti.com> X-Mailer: git-send-email 1.7.0.4 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 21 May 2010 06:15:44 +0000 (UTC) diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c index e43983b..8ce0de2 100644 --- a/arch/arm/plat-omap/iovmm.c +++ b/arch/arm/plat-omap/iovmm.c @@ -140,8 +140,10 @@ static struct sg_table *sgtable_alloc(const size_t bytes, u32 flags) return ERR_PTR(-ENOMEM); err = sg_alloc_table(sgt, nr_entries, GFP_KERNEL); - if (err) + if (err) { + kfree(sgt); return ERR_PTR(err); + } pr_debug("%s: sgt:%p(%d entries)\n", __func__, sgt, nr_entries);