Re: [PATCH] staging: media: atomisp: fix memory leak of raw_black_frame

From: Andy Shevchenko

Date: Thu Apr 16 2026 - 04:23:57 EST


On Thu, Apr 16, 2026 at 11:13:48AM +0300, Sakari Ailus wrote:
> On Thu, Apr 16, 2026 at 02:30:58PM +0800, Huihui Huang wrote:
> > Our code analyzer reported a memory leak in
> > drivers/staging/media/atomisp/pci/atomisp_cmd.c.
> >
> > In atomisp_fixed_pattern_table(), raw_black_frame is allocated by
> > atomisp_v4l2_framebuffer_to_css_frame(). If sh_css_set_black_frame()
> > fails, the function returns -ENOMEM directly without freeing
> > raw_black_frame. The allocated memory is only freed on the success
> > path.
> >
> > My patch adds the missing ia_css_frame_free() call before the error
> > return, to free raw_black_frame when sh_css_set_black_frame() fails.
> >
> > Signed-off-by: Huihui Huang <hhhuang@xxxxxxxxxx>
>
> Thanks for the patch.
>
> I believe the problem has been already addressed by
> <20260203163134.3901110-1-zilin@xxxxxxxxxx>. It's in my atomisp branch.

And exactly the way I suggested here, thanks, Sakari!

P.S.
It would be nice to see rather links to the Git commits in question, because
patch in the mailing list is just patch in the mailing list :-)

--
With Best Regards,
Andy Shevchenko