[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ea5c607-54cc-ccaf-3e4b-ee2af0160a0b@huawei.com>
Date: Mon, 24 May 2021 19:20:54 +0800
From: Wu Guanghao <wuguanghao3@...wei.com>
To: <linux-ext4@...r.kernel.org>
CC: <liuzhiqiang26@...wei.com>, <linfeilong@...wei.com>
Subject: [PATCH 03/12] zap_sector: fix memory leak
In zap_sector(), need free buf before return,
otherwise it will cause memory leak.
Signed-off-by: Wu Guanghao <wuguanghao3@...wei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@...wei.com>
Reviewed-by: Wu Bo <wubo40@...wei.com>
---
misc/mke2fs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index afbcf486..94f81da9 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -586,6 +586,7 @@ static void zap_sector(ext2_filsys fs, int sect, int nsect)
magic = (unsigned int *) (buf + BSD_LABEL_OFFSET);
if ((*magic == BSD_DISKMAGIC) ||
(*magic == BSD_MAGICDISK))
+ free(buf);
return;
}
}
--
Powered by blists - more mailing lists