/* at this point, we assume we have a valid TY stream */
msg_Dbg( p_demux, "valid TY stream detected" );
+ p_sys = malloc(sizeof(demux_sys_t));
+ if( unlikely(p_sys == NULL) )
+ return VLC_ENOMEM;
+
/* Set exported functions */
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
/* create our structure that will hold all data */
- p_demux->p_sys = p_sys = malloc(sizeof(demux_sys_t));
+ p_demux->p_sys = p_sys;
memset(p_sys, 0, sizeof(demux_sys_t));
/* set up our struct (most were zero'd out with the memset above) */
stream_Read( p_demux->s, NULL, 4 );
/* read the record headers into a temp buffer */
- p_hdr_buf = malloc(i_num_recs * 16);
+ p_hdr_buf = xmalloc(i_num_recs * 16);
if (stream_Read(p_demux->s, p_hdr_buf, i_num_recs * 16) < i_num_recs * 16) {
free( p_hdr_buf );
p_sys->eof = true;
ty_rec_hdr_t *p_hdrs, *p_rec_hdr;
*pi_payload_size = 0;
- p_hdrs = malloc(i_num_recs * sizeof(ty_rec_hdr_t));
+ p_hdrs = xmalloc(i_num_recs * sizeof(ty_rec_hdr_t));
for (i = 0; i < i_num_recs; i++)
{