mirror of https://github.com/vitalif/e2fsprogs
e2fsprogs: fix freeing bitmap in allocation error path
In ext2fs_alloc_generic_bmap() error path, when new bitmap allocation fails ext2fs_generic_bitmap should be freed, however in current state it first frees ext2fs_generic_bitmap and then ext2fs_generic_bitmap->description which is wrong. This commit fix the free ordering. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>bitmap-optimize
parent
b18c5fd51e
commit
ba7cb5d9d7
|
@ -129,8 +129,8 @@ errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic,
|
||||||
|
|
||||||
retval = bitmap->bitmap_ops->new_bmap(fs, bitmap);
|
retval = bitmap->bitmap_ops->new_bmap(fs, bitmap);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
ext2fs_free_mem(&bitmap);
|
|
||||||
ext2fs_free_mem(&bitmap->description);
|
ext2fs_free_mem(&bitmap->description);
|
||||||
|
ext2fs_free_mem(&bitmap);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue