lkml.org 
[lkml]   [2021]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] drivers/md: fix potential memleak
Date
In function get_bitmap_from_slot, when md_bitmap_create failed,
md_bitmap_destroy must be called to do clean up.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
drivers/md/md-bitmap.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index bfd6026d7809..a227bd0b9301 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -1961,6 +1961,7 @@ struct bitmap *get_bitmap_from_slot(struct mddev *mddev, int slot)
bitmap = md_bitmap_create(mddev, slot);
if (IS_ERR(bitmap)) {
rv = PTR_ERR(bitmap);
+ md_bitmap_destroy(mddev)
return ERR_PTR(rv);
}

--
2.33.1
\
 
 \ /
  Last update: 2021-11-15 04:18    [W:0.068 / U:3.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site