ext4_ext_grow_indepth() allocates memory chunk for "newblk" with ext4_ext_alloc_meta(). When getblk() and bwrite() fail in this funciton, "newblk" is not released, which will lead to a memory leak. We should release the "newblk" with ext4_ext_blkfree() when some error occurs to avoid the memory leak.
Created attachment 235103 [details] a possible patch to this bug.
LGTM, but Fedor wrote the code so he should approve.
Thanks for report. I will commit this fix little bit later, together with some another patches.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=38389acc59fcb014c5c9beed06a6f13835808b89 commit 38389acc59fcb014c5c9beed06a6f13835808b89 Author: Pedro F. Giffuni <pfg@FreeBSD.org> AuthorDate: 2022-12-17 18:19:51 +0000 Commit: Pedro F. Giffuni <pfg@FreeBSD.org> CommitDate: 2022-12-17 18:19:51 +0000 ext2fs: fix potential memory leak in ext4_ext_grow_indepth() PR: 265071 sys/fs/ext2fs/ext2_extents.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
(In reply to commit-hook from comment #5) Pedro, thank you for fix.
^Triage: committed back in 2022.