e2fsprogs/SOURCES/e2fsprogs-1.45.5-libext2fs-properly-free-the-bitmaps-in-read_bitmap-s.patch
2021-09-09 16:15:45 +00:00

37 lines
1011 B
Diff

From 764286ba7af40105ec9f27dba164fa53936c282f Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Fri, 8 Nov 2019 09:49:51 -0500
Subject: [PATCH 04/10] libext2fs: properly free the bitmaps in read_bitmap()'s
error/cleanup path
Use ext2fs_free_{block,inode}_bitmaps() instead of ext2fs_free_mem()
to avoid some memory leaks if there is an error while calling
read_bitmaps().
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/ext2fs/rw_bitmaps.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c
index f1c4188b..e092cab0 100644
--- a/lib/ext2fs/rw_bitmaps.c
+++ b/lib/ext2fs/rw_bitmaps.c
@@ -396,11 +396,11 @@ success_cleanup:
cleanup:
if (do_block) {
- ext2fs_free_mem(&fs->block_map);
+ ext2fs_free_block_bitmap(fs->block_map);
fs->block_map = 0;
}
if (do_inode) {
- ext2fs_free_mem(&fs->inode_map);
+ ext2fs_free_inode_bitmap(fs->inode_map);
fs->inode_map = 0;
}
if (inode_bitmap)
--
2.21.1