From: Simon Glass <simon.glass@canonical.com> The vidconsole device name is allocated with strdup() but never marked as allocated, so it is not freed when the device is removed. This causes a memory leak on every video device probe/remove cycle. Mark the name as allocated so driver model frees it on device removal, and free it on the error path. Fixes: 83510766c90a ("dm: video: Add a uclass for the text console") Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- (no changes since v1) drivers/video/video-uclass.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 3e02c48d399..2789c352113 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -795,8 +795,10 @@ static int video_post_probe(struct udevice *dev) ret = device_bind_driver(dev, drv_name, str, &cons); if (ret) { debug("%s: Cannot bind console driver\n", __func__); + free(str); return ret; } + device_set_name_alloced(cons); ret = device_probe(cons); if (ret) { -- 2.43.0