From patchwork Wed Aug 11 23:54:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 119132 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7C0aBVY004990 for ; Thu, 12 Aug 2010 00:38:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758442Ab0HLAfe (ORCPT ); Wed, 11 Aug 2010 20:35:34 -0400 Received: from kroah.org ([198.145.64.141]:43430 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759061Ab0HKX6i (ORCPT ); Wed, 11 Aug 2010 19:58:38 -0400 Received: from localhost (c-24-16-163-131.hsd1.wa.comcast.net [24.16.163.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by coco.kroah.org (Postfix) with ESMTPSA id D880C48B1A; Wed, 11 Aug 2010 16:58:37 -0700 (PDT) X-Mailbox-Line: From gregkh@clark.site Wed Aug 11 16:55:01 2010 Message-Id: <20100811235501.341781170@clark.site> User-Agent: quilt/0.48-11.2 Date: Wed, 11 Aug 2010 16:54:44 -0700 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: stable-review@kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Jiri Slaby , linux-btrfs@vger.kernel.org, Chris Mason , Jeff Mahoney Subject: [063/111] Btrfs, fix memory leaks in error paths In-Reply-To: <20100811235623.GA24440@kroah.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@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]); Thu, 12 Aug 2010 00:38:23 +0000 (UTC) --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -3281,8 +3281,10 @@ static noinline_for_stack int relocate_b return -ENOMEM; path = btrfs_alloc_path(); - if (!path) + if (!path) { + kfree(cluster); return -ENOMEM; + } rc->extents_found = 0; rc->extents_skipped = 0; --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2649,8 +2649,10 @@ again: em = lookup_extent_mapping(em_tree, logical, *length); read_unlock(&em_tree->lock); - if (!em && unplug_page) + if (!em && unplug_page) { + kfree(multi); return 0; + } if (!em) { printk(KERN_CRIT "unable to find logical %llu len %llu\n",