[Concept,17/33] boot: Free the logo buffer when freeing a bootflow

Message ID 20260416023021.626949-18-sjg@u-boot.org
State New
Headers
Series Fix memory leaks and test pollution in sandbox tests |

Commit Message

Simon Glass April 16, 2026, 2:29 a.m. UTC
  From: Simon Glass <sjg@chromium.org>

script_read_bootflow_file() reads boot.bmp into a local abuf and then
moves the pointer into bflow->logo with abuf_uninit_move()

The logo buffer is allocated but bootflow_free() never frees it, so
every scanned bootflow that has a logo leaks the whole image.

Free bflow->logo alongside the other bootflow fields.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 boot/bootflow.c | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/boot/bootflow.c b/boot/bootflow.c
index ff98cc4aa56..28502c309b6 100644
--- a/boot/bootflow.c
+++ b/boot/bootflow.c
@@ -754,6 +754,7 @@  void bootflow_free(struct bootflow *bflow)
 	free(bflow->fname);
 	if (!(bflow->flags & BOOTFLOWF_STATIC_BUF))
 		free(bflow->buf);
+	free(bflow->logo);
 	free(bflow->os_name);
 	free(bflow->fdt_fname);
 	/* bootmeth_priv is only set when method is set */