# \[PATCH 08/14\] fbdev: s3fb: fix potential memory leak in s3\_pci\_probe()

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

```text
In s3_pci_probe(), the memory allocated for modelist using
fb_videomode_to_modelist() is not freed in subsequent error paths.
Fix that by calling fb_destroy_modelist()

Fixes: 86c0f043a737 ("s3fb: add DDC support")
Cc: <redacted>
Signed-off-by: Abdun Nihaal <redacted>
---
 drivers/video/fbdev/s3fb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/fbdev/s3fb.c b/drivers/video/fbdev/s3fb.c
index 831e9e6861b1..dc1f9b627185 100644
--- a/drivers/video/fbdev/s3fb.c
+++ b/drivers/video/fbdev/s3fb.c
@@ -1446,6 +1446,7 @@ static int s3_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 err_alloc_cmap:
 err_find_mode:
 #ifdef CONFIG_FB_S3_DDC
+	fb_destroy_modelist(&info->modelist);
 	if (par->ddc_registered)
 		i2c_del_adapter(&par->ddc_adapter);
 	if (par->mmio)

-- 
2.43.0

```
