[parted-devel] [PATCH 5/6] hfsplus_cache_from_extent: fix memleak

Wu Guanghao wuguanghao3 at huawei.com
Wed Dec 15 08:30:03 GMT 2021


Need to release node when an error occurs

Signed-off-by: Wu Guanghao <wuguanghao3 at huawei.com>
---
 libparted/fs/r/hfs/reloc_plus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libparted/fs/r/hfs/reloc_plus.c b/libparted/fs/r/hfs/reloc_plus.c
index f065406..44e3490 100644
--- a/libparted/fs/r/hfs/reloc_plus.c
+++ b/libparted/fs/r/hfs/reloc_plus.c
@@ -670,8 +670,10 @@ hfsplus_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs,
 					_("The extents overflow file should not"
 					" contain its own extents!  You should "
 					"check the file system."))
-						!= PED_EXCEPTION_IGNORE)
+						!= PED_EXCEPTION_IGNORE) {
+					free(node);
 					return 0;
+				}
 				where = CR_BTREE_EXT_EXT;
 				break;
 			    case PED_CPU_TO_BE32 (HFS_CATALOG_ID) :
-- 
2.27.0




More information about the parted-devel mailing list