U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools: Fix handle leak in mmap_fdt function
@ 2025-02-09 14:56 Maks Mishin
  2025-02-18 19:45 ` Tom Rini
  0 siblings, 1 reply; 4+ messages in thread
From: Maks Mishin @ 2025-02-09 14:56 UTC (permalink / raw)
  To: u-boot; +Cc: Maks Mishin

The handle 'ptr' is created at fit_common.c:91 by calling 
function 'mmap' and lost at fit_common.c:127: 
Added call of free for `ptr` if ptr != MAP_FAILED.

Trigger was found by the Svace static analyzer.

Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
---
 tools/fit_common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/fit_common.c b/tools/fit_common.c
index d1cde16c1c..135e105929 100644
--- a/tools/fit_common.c
+++ b/tools/fit_common.c
@@ -123,6 +123,7 @@ err:
 		close(fd);
 	if (delete_on_error)
 		unlink(fname);
+	free(ptr);
 
 	return -1;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-18 11:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250418081526.11327-1-ant.v.moryakov@gmail.com>
2025-04-18  8:15 ` [PATCH] tools: Fix handle leak in mmap_fdt function ant.v.moryakov
2025-04-18 11:24   ` Yao Zi
2025-02-09 14:56 Maks Mishin
2025-02-18 19:45 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox