[vlc-devel] [PATCH] avcodec/encoder: fix leak in case of codec opening failure

Tristan Matthews tmatth at videolan.org
Thu Dec 6 21:52:25 CET 2018


On Thu, Dec 6, 2018 at 3:36 PM Alexandre Janniaux
<alexandre.janniaux at gmail.com> wrote:
>
> If the required codec is invalid or doesn't match the required codec id,
> we must release the string obtained from var_GetString.
> ---
>  modules/codec/avcodec/encoder.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
> index 201049cf1f..c845723a1d 100644
> --- a/modules/codec/avcodec/encoder.c
> +++ b/modules/codec/avcodec/encoder.c
> @@ -344,12 +344,14 @@ int InitVideoEnc( vlc_object_t *p_this )
>          if( !p_codec )
>          {
>              msg_Err( p_this, "Encoder `%s' not found", psz_encoder );
> +            free( psz_encoder );
>              return VLC_EGENERIC;
>          }
>          else if( p_codec->id != i_codec_id )
>          {
>              msg_Err( p_this, "Encoder `%s' can't handle %4.4s",
>                      psz_encoder, (char*)&p_enc->fmt_out.i_codec );
> +            free( psz_encoder );
>              return VLC_EGENERIC;
>          }
>      }
> --
> 2.19.2
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

Applied, thanks.


More information about the vlc-devel mailing list