# \[PATCH 14/14\] fbdev: sm501fb: fix potential memory leak in sm501fb\_probe()

- From: Abdun Nihaal \<hidden\>
- Date: 2026-05-14 08:26:35 
- List: linux-fbdev
- Page: https://ratatoskr.run/linux-fbdev/2026/05/9006102
- Thread: https://ratatoskr.run/linux-fbdev/2026/05/9006088/t.md

```text
The memory allocated for info->edid_data in sm501fb_probe() when
CONFIG_OF is defined is not freed in the subsequent error paths.
Fix that by freeing it in the error path if CONFIG_OF is defined.

Fixes: 4295f9bf74a8 ("video, sm501: add OF binding to support SM501")
Cc: <redacted>
Signed-off-by: Abdun Nihaal <redacted>
---
 drivers/video/fbdev/sm501fb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index fee4b9f84592..1ee7842517b8 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -2048,6 +2048,9 @@ static int sm501fb_probe(struct platform_device *pdev)
 	framebuffer_release(info->fb[HEAD_CRT]);
 
 err_alloc:
+#if defined(CONFIG_OF)
+	kfree(info->edid_data);
+#endif
 	kfree(info);
 
 	return ret;

-- 
2.43.0

```
