[PATCH] tools: Fix memory and descriptor leak

2025-04-18 Thread ant . v . moryakov
From: Maks Mishin Signed-off-by: Maks Mishin Signed-off-by: Anton Moryakov --- tools/zynqmpbif.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c index 82ce0ac1a52..33c68eac9f3 100644 --- a/tools/zynqmpbif.c +++ b/tools/zy

[PATCH] tools: Fix potential memory leak in aisimage.c

2025-04-18 Thread ant . v . moryakov
From: Maks Mishin 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 lea

[PATCH] tools: Fix memory and file descriptor leaks in read_full_file()

2025-04-18 Thread ant . v . moryakov
From: Maks Mishin Fixes potential memory and file descriptor leaks in the read_full_file() function. If malloc succeeds but read() fails, the buffer was not freed, and the file descriptor was not closed. This patch ensures both resources are properly released using a common exit point. Signed-of

[PATCH] tools: image-host: Fix potential memory leak

2025-04-18 Thread ant . v . moryakov
From: Maks Mishin Signed-off-by: Maks Mishin --- tools/image-host.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/image-host.c b/tools/image-host.c index 4a24dee8..6b17b810 100644 --- a/tools/image-host.c +++ b/tools/image-host.c @@ -1024,10 +1024,13 @@ static

[PATCH] scripts: Fix potential null-deref

2025-04-18 Thread ant . v . moryakov
From: Maks Mishin Signed-off-by: Maks Mishin --- scripts/kconfig/menu.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 5c5c1374..a0d0d2af 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -812,8 +

[PATCH] tools: image-host: Fix potential memory leak

2025-04-18 Thread ant . v . moryakov
From: Maks Mishin Signed-off-by: Maks Mishin --- tools/image-host.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/image-host.c b/tools/image-host.c index 4a24dee8..453cd38f 100644 --- a/tools/image-host.c +++ b/tools/image-host.c @@ -1029,10 +1029,13 @@ static

[PATCH] tools: image-host: Fix potential memory leak

2025-04-18 Thread ant . v . moryakov
From: Maks Mishin Signed-off-by: Maks Mishin --- tools/image-host.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/image-host.c b/tools/image-host.c index 4a24dee8..453cd38f 100644 --- a/tools/image-host.c +++ b/tools/image-host.c @@ -1029,10 +1029,13 @@ static

[PATCH] tools: Fix potential memory leak in aisimage.c

2025-04-18 Thread ant . v . moryakov
From: Maks Mishin Signed-off-by: Maks Mishin --- 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_t

[PATCH] tools: Fix memory and descriptor leak

2025-04-18 Thread ant . v . moryakov
From: Maks Mishin Signed-off-by: Maks Mishin --- tools/zynqmpbif.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c index 82ce0ac1..76b7a35f 100644 --- a/tools/zynqmpbif.c +++ b/tools/zynqmpbif.c @@ -226,8 +226,10 @@ static char *rea

[PATCH] tools: Fix handle leak in mmap_fdt function

2025-04-18 Thread ant . v . moryakov
From: 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 --- tools/fit_common.c | 1 + 1 file change