From: Dinghao Liu Date: Wed, 21 Oct 2020 05:36:55 +0000 (+0800) Subject: btrfs: ref-verify: fix memory leak in btrfs_ref_tree_mod X-Git-Tag: v5.4.78~43 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8266c23124c14e1f6f6fceb320a4c07edbda7132;p=users%2Fdwmw2%2Flinux.git btrfs: ref-verify: fix memory leak in btrfs_ref_tree_mod commit 468600c6ec28613b756193c5f780aac062f1acdf upstream. There is one error handling path that does not free ref, which may cause a minor memory leak. CC: stable@vger.kernel.org # 4.19+ Reviewed-by: Josef Bacik Signed-off-by: Dinghao Liu Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c index 9a2f15f4c80e0..bbd63535965c4 100644 --- a/fs/btrfs/ref-verify.c +++ b/fs/btrfs/ref-verify.c @@ -851,6 +851,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; }