# include "config.h"
#endif
+#include <assert.h>
+
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
#include <vlc_sout.h>
#include <vlc_input.h>
+#include <vlc_memory.h>
#include <ogg/ogg.h>
#include <theora/theora.h>
/* 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;
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 );
}
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;