[Concept,06/19] expo: Free gen.lines alist when destroying text objects

Message ID 20260130035849.3580212-7-simon.glass@canonical.com
State New
Headers
Series Enhanced command-line editing with undo/redo support |

Commit Message

Simon Glass Jan. 30, 2026, 3:58 a.m. UTC
  Text scene objects (SCENEOBJT_TEXT) have a gen.lines alist that stores
line measurement info populated during rendering. This alist was not
being freed when the object was destroyed, causing a memory leak.

Add cleanup for gen.lines in scene_obj_destroy() for TEXT objects.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 boot/scene.c | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/boot/scene.c b/boot/scene.c
index ff21b524843..b075697adb6 100644
--- a/boot/scene.c
+++ b/boot/scene.c
@@ -110,6 +110,8 @@  void scene_obj_destroy(struct scene_obj *obj)
 	else if (obj->type == SCENEOBJT_TEXTLINE ||
 		 obj->type == SCENEOBJT_TEXTEDIT)
 		scene_txtin_destroy(obj->scene, scene_obj_txtin(obj));
+	if (obj->type == SCENEOBJT_TEXT)
+		alist_uninit(&((struct scene_obj_txt *)obj)->gen.lines);
 	free(obj->name);
 	free(obj);
 }