X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcodec%2Ftheora.c;h=8f5e328f02499f90cf508194a403604aaf1aa2df;hb=15643af1;hp=df5b4844df285e027bb814a2a7196fc556cd254f;hpb=4e4720311a10bf0917cc826369438c6565d56a4f;p=vlc diff --git a/modules/codec/theora.c b/modules/codec/theora.c index df5b4844df..8f5e328f02 100644 --- a/modules/codec/theora.c +++ b/modules/codec/theora.c @@ -28,11 +28,14 @@ # include "config.h" #endif +#include + #include #include #include #include #include +#include #include #include @@ -215,9 +218,9 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) /* Backup headers as extra data */ uint8_t *p_extra; - p_dec->fmt_in.p_extra = - realloc( p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra + - oggpacket.bytes + 2 ); + p_dec->fmt_in.p_extra = realloc_or_free( p_dec->fmt_in.p_extra, + p_dec->fmt_in.i_extra + oggpacket.bytes + 2 ); + assert( p_dec->fmt_in.p_extra ); p_extra = ((uint8_t *)p_dec->fmt_in.p_extra) + p_dec->fmt_in.i_extra; *(p_extra++) = oggpacket.bytes >> 8; *(p_extra++) = oggpacket.bytes & 0xFF; @@ -404,8 +407,9 @@ 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 = - realloc( p_dec->fmt_out.p_extra, p_dec->fmt_out.i_extra ); + p_dec->fmt_out.p_extra = realloc_or_free( p_dec->fmt_out.p_extra, + p_dec->fmt_out.i_extra ); + assert( p_dec->fmt_out.p_extra ); memcpy( p_dec->fmt_out.p_extra, p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra ); } @@ -706,9 +710,9 @@ static int OpenEncoder( vlc_object_t *p_this ) else if( i == 1 ) theora_encode_comment( &p_sys->tc, &header ); else if( i == 2 ) theora_encode_tables( &p_sys->td, &header ); - p_enc->fmt_out.p_extra = - realloc( p_enc->fmt_out.p_extra, - p_enc->fmt_out.i_extra + header.bytes ); + p_enc->fmt_out.p_extra = realloc_or_free( p_enc->fmt_out.p_extra, + p_enc->fmt_out.i_extra + header.bytes ); + assert( p_enc->fmt_out.p_extra ); p_extra = p_enc->fmt_out.p_extra; p_extra += p_enc->fmt_out.i_extra + (i-3)*2; p_enc->fmt_out.i_extra += header.bytes;