On 9/27/20 07:40, Zhao Heming wrote:
current code doesn't free temporary bitmap memory.
Signed-off-by: Zhao Heming <heming.zhao@xxxxxxxx>
---
drivers/md/md-bitmap.c | 1 +
drivers/md/md-cluster.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index b10c519..593fe15 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -2012,6 +2012,7 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot,
md_bitmap_unplug(mddev->bitmap);
*low = lo;
*high = hi;
+ md_bitmap_free(bitmap);
return rv;
}
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index d50737e..afbbc55 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -1166,6 +1166,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz
* can't resize bitmap
*/
goto out;
+ md_bitmap_free(bitmap);
}
return 0;
I'd prefer add a comment for get_bitmap_from_slot to mention it's caller
need to
free bitmap.
Thanks,
Guoqing