[PATCH mtd-utils] nor-utils: fix memory leak

Liao Hua liaohua4 at huawei.com
Thu Feb 17 19:22:19 PST 2022


From: liaohua <liaohua4 at huawei.com>

This patch replace "free(rfd.sector_map)" with "free(rfd.header)"
to fix memory leak.

Signed-off-by: liaohua <liaohua4 at huawei.com>
---
 nor-utils/rfddump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nor-utils/rfddump.c b/nor-utils/rfddump.c
index 01ab4c2..78ec443 100644
--- a/nor-utils/rfddump.c
+++ b/nor-utils/rfddump.c
@@ -256,7 +256,7 @@ int main(int argc, char *argv[])
 	if (!rfd.sector_map) {
 		perror(PROGRAM_NAME);
 		close(fd);
-		free(rfd.sector_map);
+		free(rfd.header);
 		return 2;
 	}
 
-- 
2.12.3




More information about the linux-mtd mailing list