From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1owLH9-0002TN-75 for mharc-grub-devel@gnu.org; Sat, 19 Nov 2022 05:40:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1owLH5-0002S0-3d for grub-devel@gnu.org; Sat, 19 Nov 2022 05:40:39 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1owLH0-0008GU-1j for grub-devel@gnu.org; Sat, 19 Nov 2022 05:40:38 -0500 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NDqsW6kPXzHvqg; Sat, 19 Nov 2022 18:39:43 +0800 (CST) Received: from kwepemm600019.china.huawei.com (7.193.23.64) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 19 Nov 2022 18:40:17 +0800 Received: from huawei.com (10.44.134.232) by kwepemm600019.china.huawei.com (7.193.23.64) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 19 Nov 2022 18:40:16 +0800 From: t.feng To: CC: , , , Subject: [PATCH 2/9] fs/btrfs: Fix memory leak in find_path Date: Sat, 19 Nov 2022 18:39:39 +0800 Message-ID: <20221119103946.657744-3-fengtao40@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20221119103946.657744-1-fengtao40@huawei.com> References: <20221119103946.657744-1-fengtao40@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.44.134.232] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600019.china.huawei.com (7.193.23.64) X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.188; envelope-from=fengtao40@huawei.com; helo=szxga02-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Nov 2022 10:40:40 -0000 Fix memory leak in find_path. Fixs: 82591fa6e(Make / in btrfe refer to real root) Signed-off-by: "t.feng" --- grub-core/fs/btrfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index ec72f7be3..19bff4610 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -1982,7 +1982,12 @@ find_path (struct grub_btrfs_data *data, { err = get_root (data, key, tree, type); if (err) - return err; + { + grub_free (direl); + grub_free (path_alloc); + grub_free (origpath); + return err; + } } continue; } -- 2.27.0