]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: properly free the bitmaps in read_bitmap()'s error/cleanup path
authorTheodore Ts'o <tytso@mit.edu>
Fri, 8 Nov 2019 14:49:51 +0000 (09:49 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 8 Nov 2019 14:49:51 +0000 (09:49 -0500)
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

index f1c4188bad1ab22f405455bf2088e5ec2abc3ecb..e092cab004718b837057e4177c3b1706fb0e0f06 100644 (file)
@@ -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)