[vlc-devel] [PATCH] ogg codecs: use checked realloc() instead of xrealloc()

Francois Cartegnie fcvlcdev at free.fr
Fri Mar 4 10:00:38 CET 2016


Le 04/03/2016 02:20, Michael Tänzer a écrit :
> ---
>  modules/codec/daala.c    |  7 ++++++-
>  modules/codec/kate.c     |  8 ++++++--
>  modules/codec/oggspots.c |  7 +++++--
>  modules/codec/speex.c    |  8 ++++++--
>  modules/codec/theora.c   | 10 ++++++++--
>  modules/codec/vorbis.c   |  8 ++++++--
>  6 files changed, 37 insertions(+), 11 deletions(-)
> 
> diff --git a/modules/codec/daala.c b/modules/codec/daala.c
> index ae790dd..47ae15e 100644
> --- a/modules/codec/daala.c
> +++ b/modules/codec/daala.c
> @@ -381,8 +381,13 @@ static int ProcessHeaders( decoder_t *p_dec )
>      else
>      {
>          p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
> -        p_dec->fmt_out.p_extra = xrealloc( p_dec->fmt_out.p_extra,
> +        p_dec->fmt_out.p_extra = realloc( p_dec->fmt_out.p_extra,
>                  p_dec->fmt_out.i_extra );
> +        if( p_dec->fmt_out.p_extra == NULL )
> +        {
> +            ret = VLC_ENOMEM;
> +            goto cleanup;
> +        }
>          memcpy( p_dec->fmt_out.p_extra,
>                  p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra );
>      }


No. man realloc.
You replaced xreallocs with leaking reallocs.

Francois


More information about the vlc-devel mailing list