p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = (demux_sys_t *)malloc( sizeof( demux_sys_t ) );
- assert(p_sys);
+ if( unlikely( !p_sys ) )
+ return VLC_ENOMEM;
msg_Dbg( p_demux, "loading complete file (could be long)" );
p_sys->i_data = stream_Size( p_demux->s );
p_sys->p_data = (uint8_t *)malloc( p_sys->i_data );
- assert(p_sys->p_data);
+ if( unlikely( !p_sys->p_data ) )
+ {
+ free( p_sys );
+ return VLC_ENOMEM;
+ }
p_sys->i_data = stream_Read( p_demux->s, p_sys->p_data, p_sys->i_data );
if( p_sys->i_data <= 0 )
{
int *pi_int = (int*)va_arg( args, int* );
*pi_int = p_sys->i_tracks;
- *ppp_title = (input_title_t**)malloc( sizeof( input_title_t**) * p_sys->i_tracks );
- assert( *ppp_sitle );
+ *ppp_title = (input_title_t**)xmalloc( sizeof( input_title_t**) * p_sys->i_tracks );
for( int i = 0; i < p_sys->i_tracks; i++ )
{
memset(&z_str, 0, sizeof(z_str));
out_size = i_size * 2;
- out_buffer = (uint8_t*)malloc(out_size);
- assert(out_buffer);
+ out_buffer = (uint8_t*)xmalloc(out_size);
z_str.next_in = (unsigned char*)p_buffer;
z_str.avail_in = i_size;
case Z_BUF_ERROR:
offset = z_str.next_out - out_buffer;
out_size *= 2;
- out_buffer = (uint8_t *)realloc_or_free(out_buffer, out_size);
- assert(out_buffer);
+ out_buffer = (uint8_t *)xrealloc(out_buffer, out_size);
z_str.next_out = out_buffer + offset;
z_str.avail_out = out_size - offset;
break;
inflateEnd(&z_str);
- out_buffer = (uint8_t *)realloc_or_free(out_buffer, *pi_osize);
- assert(out_buffer);
+ out_buffer = (uint8_t *)xrealloc(out_buffer, *pi_osize);
(*pp_obuffer) = out_buffer;
}
#endif