btrfs-progs: zoned: fix memory leak in btrfs_sb_io()
In btrfs_sb_io(), blk_zone_report is used for getting information about zones. But it is not freed if code goes in usual path. This patch frees the variable just after it used. Reviewed-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com> Signed-off-by: Sidong Yang <realwakka@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
a7ed5b0ced
commit
94f3b75c00
|
@ -552,6 +552,7 @@ size_t btrfs_sb_io(int fd, void *buf, off_t offset, int rw)
|
|||
zones = (struct blk_zone *)(rep + 1);
|
||||
|
||||
ret = sb_log_location(fd, zones, rw, &mapped);
|
||||
free(rep);
|
||||
/*
|
||||
* Special case: no superblock found in the zones. This case happens
|
||||
* when initializing a file-system.
|
||||
|
|
Loading…
Reference in New Issue