[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260201072107.1797351-1-zilin@seu.edu.cn>
Date: Sun, 1 Feb 2026 07:21:07 +0000
From: Zilin Guan <zilin@....edu.cn>
To: hansg@...nel.org
Cc: mchehab@...nel.org,
sakari.ailus@...ux.intel.com,
andy@...nel.org,
gregkh@...uxfoundation.org,
hverkuil@...nel.org,
linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-staging@...ts.linux.dev,
jianhao.xu@....edu.cn,
Zilin Guan <zilin@....edu.cn>
Subject: [PATCH] media: atomisp: Fix memory leak in atomisp_fixed_pattern_table()
atomisp_v4l2_framebuffer_to_css_frame() allocates memory for
raw_black_frame, which must be released via ia_css_frame_free().
However, if sh_css_set_black_frame() fails, the function returns
immediately without performing this cleanup, leading to a memory leak.
Fix this by assigning the error code to ret and allowing the code to
fall through to the ia_css_frame_free() call.
Compile tested only. Issue found using a prototype static analysis tool
and code review.
Fixes: 85b606e02ad7 ("media: atomisp: get rid of a bunch of other wrappers")
Signed-off-by: Zilin Guan <zilin@....edu.cn>
---
drivers/staging/media/atomisp/pci/atomisp_cmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
index 3a4eb4f6d3be..208ff85cd7fb 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
@@ -3369,7 +3369,7 @@ int atomisp_fixed_pattern_table(struct atomisp_sub_device *asd,
if (sh_css_set_black_frame(asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream,
raw_black_frame) != 0)
- return -ENOMEM;
+ ret = -ENOMEM;
ia_css_frame_free(raw_black_frame);
return ret;
--
2.34.1
Powered by blists - more mailing lists