From patchwork Mon Apr 18 02:27:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 8864451 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0732CBF440 for ; Mon, 18 Apr 2016 02:29:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B0F72011B for ; Mon, 18 Apr 2016 02:29:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1C31D201C0 for ; Mon, 18 Apr 2016 02:29:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751487AbcDRC3v (ORCPT ); Sun, 17 Apr 2016 22:29:51 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:36890 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752007AbcDRC3t (ORCPT ); Sun, 17 Apr 2016 22:29:49 -0400 X-IronPort-AV: E=Sophos;i="5.20,367,1444665600"; d="scan'208";a="438855" Received: from unknown (HELO cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 18 Apr 2016 10:29:14 +0800 Received: from localhost.localdomain (unknown [10.167.226.34]) by cn.fujitsu.com (Postfix) with ESMTP id 5511E4056403; Mon, 18 Apr 2016 10:29:10 +0800 (CST) From: Qu Wenruo 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 Message-Id: <1460946429-578-2-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1460946429-578-1-git-send-email-quwenruo@cn.fujitsu.com> References: <1460946429-578-1-git-send-email-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 5511E4056403.A8EE5 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: quwenruo@cn.fujitsu.com X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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); } }