diff mbox series

media: imx: csc/scaler: fix v4l2_ctrl_handler memory leak

Message ID 20240131120033.858877-1-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series media: imx: csc/scaler: fix v4l2_ctrl_handler memory leak | expand

Commit Message

Lucas Stach Jan. 31, 2024, noon UTC
Free the memory allocated in v4l2_ctrl_handler_init on release.

Fixes: a8ef0488cc59 ("media: imx: add csc/scaler mem2mem device")
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/staging/media/imx/imx-media-csc-scaler.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Philipp Zabel Feb. 2, 2024, 8:16 a.m. UTC | #1
On Mi, 2024-01-31 at 13:00 +0100, Lucas Stach wrote:
> Free the memory allocated in v4l2_ctrl_handler_init on release.
> 
> Fixes: a8ef0488cc59 ("media: imx: add csc/scaler mem2mem device")
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/staging/media/imx/imx-media-csc-scaler.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/media/imx/imx-media-csc-scaler.c b/drivers/staging/media/imx/imx-media-csc-scaler.c
> index 1fd39a2fca98..95cca281e8a3 100644
> --- a/drivers/staging/media/imx/imx-media-csc-scaler.c
> +++ b/drivers/staging/media/imx/imx-media-csc-scaler.c
> @@ -803,6 +803,7 @@ static int ipu_csc_scaler_release(struct file *file)
>  
>  	dev_dbg(priv->dev, "Releasing instance %p\n", ctx);
>  
> +	v4l2_ctrl_handler_free(&ctx->ctrl_hdlr);
>  	v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
>  	v4l2_fh_del(&ctx->fh);
>  	v4l2_fh_exit(&ctx->fh);

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/staging/media/imx/imx-media-csc-scaler.c b/drivers/staging/media/imx/imx-media-csc-scaler.c
index 1fd39a2fca98..95cca281e8a3 100644
--- a/drivers/staging/media/imx/imx-media-csc-scaler.c
+++ b/drivers/staging/media/imx/imx-media-csc-scaler.c
@@ -803,6 +803,7 @@  static int ipu_csc_scaler_release(struct file *file)
 
 	dev_dbg(priv->dev, "Releasing instance %p\n", ctx);
 
+	v4l2_ctrl_handler_free(&ctx->ctrl_hdlr);
 	v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
 	v4l2_fh_del(&ctx->fh);
 	v4l2_fh_exit(&ctx->fh);