]> git.sesse.net Git - vlc/blobdiff - modules/demux/ty.c
demux/mp4: do not demux f4v files for now
[vlc] / modules / demux / ty.c
index a9e0d2a54397011303e11c0a1592f400082079aa..a74d0a915aa820faabf30407816008d00ccee3af 100644 (file)
@@ -417,7 +417,7 @@ static int Demux( demux_t *p_demux )
     /* 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;
     }
 
@@ -1887,12 +1887,13 @@ static int get_chunk_header(demux_t *p_demux)
     /*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;
@@ -1919,7 +1920,7 @@ static ty_rec_hdr_t *parse_chunk_headers( const uint8_t *p_buf,
     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++)
     {