linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: linux-btrfs@vger.kernel.org, mfasheh@suse.de
Subject: [PATCH 2/3] btrfs-progs: Fix an extent buffer leak in qgroups check
Date: Mon, 18 Apr 2016 10:27:08 +0800	[thread overview]
Message-ID: <1460946429-578-2-git-send-email-quwenruo@cn.fujitsu.com> (raw)
In-Reply-To: <1460946429-578-1-git-send-email-quwenruo@cn.fujitsu.com>

Qgroup verify codes will read fs root to check if the subvolume exists.
But it forgot to free the extent buffer read out, only freeing the
memory.

Fix it by also freeing the extent buffers.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 qgroup-verify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qgroup-verify.c b/qgroup-verify.c
index c4e9201..48e4d22 100644
--- a/qgroup-verify.c
+++ b/qgroup-verify.c
@@ -761,7 +761,7 @@ static int load_quota_info(struct btrfs_fs_info *info)
 			tmproot = btrfs_read_fs_root_no_cache(info, &root_key);
 			if (tmproot && !IS_ERR(tmproot)) {
 				count->subvol_exists = 1;
-				free(tmproot);
+				btrfs_free_fs_root(tmproot);
 			}
 		}
 
-- 
2.8.0




  reply	other threads:[~2016-04-18  2:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18  2:27 [PATCH 1/3] btrfs-progs: Fix return value bug of qgroups check Qu Wenruo
2016-04-18  2:27 ` Qu Wenruo [this message]
2016-04-18  2:27 ` [PATCH 3/3] btrfs-progs: Read qgroup status for qgroup verify Qu Wenruo
2016-04-25 12:09 ` [PATCH 1/3] btrfs-progs: Fix return value bug of qgroups check David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460946429-578-2-git-send-email-quwenruo@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=mfasheh@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).