media: atomisp: Fix memory leak in atomisp_alloc_dis_coef_buf
Subsystems (4)
PATCH 1/1 media: atomisp: Fix memory leak in atomisp_alloc_dis_coef_buf
Free the allocated dvs2_coeff memory if ia_css_dvs2_statistics_allocate
fails to prevent a memory leak in the error path.
Signed-off-by Abdullah Mohammd Sifat <[email protected]>
--- drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +5 -1
@@ -1373,8 +1373,12 @@ int atomisp_alloc_dis_coef_buf(struct atomisp_sub_device *asd)/* DIS projections. */ asd->params.dis_proj_data_valid = false; asd->params.dvs_stat =ia_css_dvs2_statistics_allocate (dvs_grid); -if (!asd->params.dvs_stat) +if (!asd->params.dvs_stat) { +ia_css_dvs2_coefficients_free (asd->params.css_param.dvs2_coeff); + asd->params.css_param.dvs2_coeff =NULL ;return -ENOMEM ; + } + asd->params.dvs_hor_proj_bytes = dvs_grid->aligned_height * dvs_grid->aligned_width *
Signature · 1 line
2.53.0
Quoted 5 lines · Abdullah Mohammd Sifat
Free the allocated
dvs2_coeffmemory ifia_css_dvs2_statistics_allocatefails to prevent a memory leak in the error path.
Signed-off-by Abdullah Mohammd Sifat <[email protected]>
The commit message says it is a bug but there is no Fixes tag.
However, it is not a bug because the memory is freed in the caller.
regards,
dan carpenter