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

Liao Hua posted 1 patch 4 years, 4 months ago
nor-utils/rfddump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH mtd-utils] nor-utils: fix memory leak
Posted by Liao Hua 4 years, 4 months ago
From: liaohua <liaohua4@huawei.com>

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

Signed-off-by: liaohua <liaohua4@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