diff mbox series

btrfs: ref-verify: Fix memleak in btrfs_ref_tree_mod

Message ID 20201021053655.28624-1-dinghao.liu@zju.edu.cn (mailing list archive)
State New, archived
Headers show
Series btrfs: ref-verify: Fix memleak in btrfs_ref_tree_mod | expand

Commit Message

Dinghao Liu Oct. 21, 2020, 5:36 a.m. UTC
There is one error handling path does not free ref,
which may cause a memory leak.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 fs/btrfs/ref-verify.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Sterba Nov. 5, 2020, 11:51 a.m. UTC | #1
On Wed, Oct 21, 2020 at 01:36:55PM +0800, Dinghao Liu wrote:
> There is one error handling path does not free ref,
> which may cause a memory leak.
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>

Added to misc-next, thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c
index 7f03dbe5b609..78693d3dd15b 100644
--- a/fs/btrfs/ref-verify.c
+++ b/fs/btrfs/ref-verify.c
@@ -860,6 +860,7 @@  int btrfs_ref_tree_mod(struct btrfs_fs_info *fs_info,
 "dropping a ref for a root that doesn't have a ref on the block");
 			dump_block_entry(fs_info, be);
 			dump_ref_action(fs_info, ra);
+			kfree(ref);
 			kfree(ra);
 			goto out_unlock;
 		}