diff options
author | Qu Wenruo <wqu@suse.com> | 2018-02-14 16:09:56 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-02-14 16:33:31 +0100 |
commit | b8e884f1cda145c73115e2ff9dde096d39e199ca (patch) | |
tree | de049a77c2577cadb11ed5215502310e03db5a38 /convert | |
parent | 78c5a90ebf22989b07770de6324cc14a70d72a17 (diff) |
btrfs-progs: convert/ext2: Fix memory leak caused by handled ext2_filsys
Exposed by convert-test with D=asan.
Unlike btrfs, ext2fs_close() still leaves its ext2_filsys parameter
filled with allocated pointers.
It needs ext2fs_free() to free those pointers.
Issue: #92
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'convert')
-rw-r--r-- | convert/source-ext2.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/convert/source-ext2.c b/convert/source-ext2.c index f5ecd8cf..b1492c78 100644 --- a/convert/source-ext2.c +++ b/convert/source-ext2.c @@ -95,6 +95,7 @@ static int ext2_open_fs(struct btrfs_convert_context *cctx, const char *name) return 0; fail: ext2fs_close(ext2_fs); + ext2fs_free(ext2_fs); return -1; } @@ -179,6 +180,7 @@ static void ext2_close_fs(struct btrfs_convert_context *cctx) cctx->volume_name = NULL; } ext2fs_close(cctx->fs_data); + ext2fs_free(cctx->fs_data); } static u8 ext2_filetype_conversion_table[EXT2_FT_MAX] = { |