From: Simon Glass <simon.glass@canonical.com> The scratch buffer and glyph buffer are allocated during probe but never freed. Add a remove callback to free these buffers when the truetype console device is removed. Fixes: 159af15074f2 ("video: truetype: Add a scratch buffer to use malloc() less") Fixes: 69d2f4ab58d2 ("video: truetype: Use pre-allocated buffer for glyph rendering") Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- (no changes since v1) drivers/video/console_truetype.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 6e65f55d598..c33686aff9b 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -1243,6 +1243,16 @@ static int console_truetype_probe(struct udevice *dev) return 0; } +static int console_truetype_remove(struct udevice *dev) +{ + struct console_tt_priv *priv = dev_get_priv(dev); + + free(priv->scratch_buf); + free(priv->glyph_buf); + + return 0; +} + struct vidconsole_ops console_truetype_ops = { .putc_xy = console_truetype_putc_xy, .move_rows = console_truetype_move_rows, @@ -1265,5 +1275,6 @@ U_BOOT_DRIVER(vidconsole_truetype) = { .id = UCLASS_VIDEO_CONSOLE, .ops = &console_truetype_ops, .probe = console_truetype_probe, + .remove = console_truetype_remove, .priv_auto = sizeof(struct console_tt_priv), }; -- 2.43.0