aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2019-11-08 09:49:51 -0500
committerTheodore Ts'o <tytso@mit.edu>2019-11-08 09:49:51 -0500
commita2a8cec68c69583b8de5409ade3cd641c7d4cef7 (patch)
treee0b3b2eac2999ecdc64c563f024b360d96a7ffa0
parent6dac306792b98ae9111e8da2b2f4341592812c5a (diff)
downloade2fsprogs-a2a8cec68c69583b8de5409ade3cd641c7d4cef7.tar.gz
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>
-rw-r--r--lib/ext2fs/rw_bitmaps.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c
index f1c4188ba..e092cab00 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)