[FFmpeg-devel] [PATCH] libavcodec/v4l2_m2m_enc:free v4l2 encode session properly when initialiZzation fails Fix ticket 8285 bug

Andriy Gelman andriy.gelman at gmail.com
Sun Nov 3 04:55:48 EET 2019


On Mon, 21. Oct 23:01, Colin NG wrote:
> ---
>  libavcodec/v4l2_m2m_enc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
> index 474e6bef89..17fc3d30cf 100644
> --- a/libavcodec/v4l2_m2m_enc.c
> +++ b/libavcodec/v4l2_m2m_enc.c
> @@ -312,6 +312,7 @@ static av_cold int v4l2_encode_init(AVCodecContext *avctx)
>      ret = ff_v4l2_m2m_codec_init(priv);
>      if (ret) {
>          av_log(avctx, AV_LOG_ERROR, "can't configure encoder\n");

> +        ff_v4l2_m2m_codec_end(priv);

Is it better to add .caps_internal = FF_CODEC_CAP_INIT_CLEANUP instead ? 
This will avoid the same mem leak if v4l2_prepare_encoder() fails below.

Also, fix your commit title/message. 

Thanks,
-- 
Andriy


More information about the ffmpeg-devel mailing list