* [PATCH] btrfs-progs: convert/ext2: Fix memory leak caused by handled ext2_filsys
@ 2018-02-14 8:09 Qu Wenruo
2018-02-14 15:37 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Qu Wenruo @ 2018-02-14 8:09 UTC (permalink / raw)
To: linux-btrfs, dsterba
Exposed 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.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
convert/source-ext2.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/convert/source-ext2.c b/convert/source-ext2.c
index e9277213b77a..67e97cf87185 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] = {
--
2.16.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs-progs: convert/ext2: Fix memory leak caused by handled ext2_filsys
2018-02-14 8:09 [PATCH] btrfs-progs: convert/ext2: Fix memory leak caused by handled ext2_filsys Qu Wenruo
@ 2018-02-14 15:37 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2018-02-14 15:37 UTC (permalink / raw)
To: Qu Wenruo; +Cc: linux-btrfs, dsterba
On Wed, Feb 14, 2018 at 04:09:56PM +0800, Qu Wenruo wrote:
> Exposed 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.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-14 15:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-14 8:09 [PATCH] btrfs-progs: convert/ext2: Fix memory leak caused by handled ext2_filsys Qu Wenruo
2018-02-14 15:37 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).