[PATCH] tools: Fix potential memory leak in aisimage.c
ant.v.moryakov at gmail.com
ant.v.moryakov at gmail.com
Fri Apr 18 19:49:39 CEST 2025
From: Maks Mishin <maks.mishinFZ at gmail.com>
The 'line' variable is dynamically allocated by getline() function
during config file parsing but wasn't being freed before function
exit, causing memory leak. This was detected by static analysis.
Add missing free() call before closing the file descriptor to
prevent memory leak.
Signed-off-by: Maks Mishin <maks.mishinFZ at gmail.com>
Signed-off-by: Anton Moryakov <ant.v.moryakov at gmail.com>
---
tools/aisimage.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/aisimage.c b/tools/aisimage.c
index b8b3ee32..6091c8d5 100644
--- a/tools/aisimage.c
+++ b/tools/aisimage.c
@@ -346,6 +346,7 @@ static int aisimage_generate(struct image_tool_params *params,
}
}
+ free(line);
fclose(fd);
aishdr = ais_copy_image(params, aishdr);
--
2.34.1
More information about the U-Boot
mailing list