Re: [PATCH] staging: media: atomisp: fix memory leak of dvs2_coeff
From: Andy Shevchenko
Date: Thu Apr 16 2026 - 04:08:50 EST
On Thu, Apr 16, 2026 at 02:41:52PM +0800, Huihui Huang wrote:
> Our code analyzer reported a memory leak in
> drivers/staging/media/atomisp/pci/atomisp_compat_css20.c.
>
> In atomisp_alloc_dis_coef_buf(), dvs2_coeff is allocated by
> ia_css_dvs2_coefficients_allocate() and stored in
> asd->params.css_param.dvs2_coeff. If the subsequent
> ia_css_dvs2_statistics_allocate() for dvs_stat fails, the function
> returns -ENOMEM without freeing the previously allocated dvs2_coeff.
> My patch adds the missing ia_css_dvs2_coefficients_free() call and
> sets the pointer to NULL before returning on the error path.
Please, read Submitting Patches (find "imperative mood" there).
...
The code looks okay, though.
--
With Best Regards,
Andy Shevchenko