Thread (4 messages) 4 messages, 4 authors, 2021-07-01

Re: [PATCH] btrfs-progs: zoned: fix memory leak in btrfs_sb_io()

From: Qu Wenruo <hidden>
Date: 2021-06-26 21:45:07


On 2021/6/26 下午11:03, Sidong Yang wrote:
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.

Signed-off-by: Sidong Yang <redacted>
Reviewed-by: Qu Wenruo <redacted>

Thanks,
Qu
quoted hunk ↗ jump to hunk
---
  kernel-shared/zoned.c | 1 +
  1 file changed, 1 insertion(+)
diff --git a/kernel-shared/zoned.c b/kernel-shared/zoned.c
index 2a6892b3..75eade84 100644
--- a/kernel-shared/zoned.c
+++ b/kernel-shared/zoned.c
@@ -543,6 +543,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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help