From patchwork Sat Apr 9 02:30:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshinori Sano X-Patchwork-Id: 695701 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p392Ufwi012865 for ; Sat, 9 Apr 2011 02:30:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753061Ab1DICaX (ORCPT ); Fri, 8 Apr 2011 22:30:23 -0400 Received: from mail-px0-f179.google.com ([209.85.212.179]:62298 "EHLO mail-px0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752192Ab1DICaW (ORCPT ); Fri, 8 Apr 2011 22:30:22 -0400 Received: by pxi2 with SMTP id 2so2108282pxi.10 for ; Fri, 08 Apr 2011 19:30:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=7wEMMnWMTLGFuX//W6mP8+RNg2WBdslbnpX2afe1ToY=; b=RnQLobqC7iFGTVhhLKlpxGG0eC3Hh5bOiU3xTar6l1hJbxh/S+Z7ed6kXuBnJrNkXT bZ+5/YmPCshlFpn84xOBJrjDMF7UdRSB2VRvTnyV+6ohE9JtQ8I972/ajgZY1iQBQ2uG EEGdPFnRKrQ8dIV0FY9Xlah1Whn/wVuEpgosA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=xNfNL0OT6QhA1ZbnJPTRUx28bnnfk9xoSF2cV/8ihSGjDXZfWmAhlholOUype7o9Jf 5H8KkDr3qtPAvsiaZNj2J+kxiyU0xj6kQ3tr4ERBUlTo2mN1772jRzYA5rwqaV8SBCkU r9EJWIMR1aWQwE8tOH056f2/z3U7mpMzlHq/4= Received: by 10.142.98.13 with SMTP id v13mr2534382wfb.279.1302316222300; Fri, 08 Apr 2011 19:30:22 -0700 (PDT) Received: from localhost (EM114-51-131-16.pool.e-mobile.ne.jp [114.51.131.16]) by mx.google.com with ESMTPS id m10sm4427967wfl.23.2011.04.08.19.30.16 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 08 Apr 2011 19:30:21 -0700 (PDT) From: Yoshinori Sano To: linux-btrfs@vger.kernel.org Cc: chris.mason@oracle.com, Yoshinori Sano Subject: [PATCH] Btrfs: fix memory leaks in btrfs_new_inode() Date: Sat, 9 Apr 2011 11:30:07 +0900 Message-Id: <1302316207-30806-1-git-send-email-yoshinori.sano@gmail.com> X-Mailer: git-send-email 1.7.1 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.6 (demeter1.kernel.org [140.211.167.41]); Sat, 09 Apr 2011 02:30:42 +0000 (UTC) This patch fixes memory leaks in btrfs_new_inode(). Signed-off-by: Yoshinori Sano --- fs/btrfs/inode.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index aa116dc..d8c93c1 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4536,14 +4536,17 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, return ERR_PTR(-ENOMEM); inode = new_inode(root->fs_info->sb); - if (!inode) + if (!inode) { + btrfs_free_path(path); return ERR_PTR(-ENOMEM); + } if (dir) { trace_btrfs_inode_request(dir); ret = btrfs_set_inode_index(dir, index); if (ret) { + btrfs_free_path(path); iput(inode); return ERR_PTR(ret); }