/* parse the next chunk's record headers */
if( p_sys->b_first_chunk || p_sys->i_cur_rec >= p_sys->i_num_recs )
{
- if( get_chunk_header(p_demux) == 0 )
+ if( get_chunk_header(p_demux) == 0 || p_sys->i_num_recs == 0 )
return 0;
}
/*msg_Dbg( p_demux, "chunk has %d records", i_num_recs );*/
free(p_sys->rec_hdrs);
+ p_sys->rec_hdrs = NULL;
/* skip past the 4 bytes we "peeked" earlier */
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++)
{