From: Theodore Ts'o Date: Fri, 8 Nov 2019 14:49:51 +0000 (-0500) Subject: libext2fs: properly free the bitmaps in read_bitmap()'s error/cleanup path X-Git-Tag: v1.45.5~46 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=a2a8cec68c69583b8de5409ade3cd641c7d4cef7;p=tools%2Fe2fsprogs.git 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 --- diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c index f1c4188..e092cab 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)