Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
btrfs: fix possible memory leak in btrfs_get_dev_args_from_path()
In btrfs_get_dev_args_from_path(), btrfs_get_bdev_and_sb() can fail if the path is invalid. In this case, btrfs_get_dev_args_from_path() returns directly without freeing args->uuid and args->fsid allocated before, which causes memory leak. To fix these possible leaks, when btrfs_get_bdev_and_sb() fails, btrfs_put_dev_args_from_path() is called to clean up the memory. Reported-by: TOTE Robot <[email protected]> Fixes: faa775c ("btrfs: add a btrfs_get_dev_args_from_path helper") CC: [email protected] # 5.16 Reviewed-by: Boris Burkov <[email protected]> Signed-off-by: Zixuan Fu <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
- Loading branch information