- fmt.i_extra = 22 + (p_sys->i_totalframes * 4) + 4;
- fmt.p_extra = malloc( fmt.i_extra );
- memcpy( (uint8_t*)fmt.p_extra, p_header, 22 );
- memcpy( (uint8_t*)fmt.p_extra+22, p_seektable, fmt.i_extra -22 );
+ fmt.i_extra = 22 + i_seektable_size + 4;
+ fmt.p_extra = p_fullheader = malloc( fmt.i_extra );
+ if( !p_fullheader )
+ goto error;
+
+ memcpy( p_fullheader, p_header, 22 );
+ p_fullheader += 22;
+ if( stream_Read( p_demux->s, p_fullheader, i_seektable_size )
+ != i_seektable_size )
+ goto error;
+
+ p_sys->pi_seektable = calloc( p_sys->i_totalframes, sizeof(uint32_t) );
+ if( !p_sys->pi_seektable )
+ goto error;
+ for( uint32_t i = 0; i < p_sys->i_totalframes; i++ )
+ {
+ p_sys->pi_seektable[i] = GetDWLE( p_fullheader );
+ p_fullheader += 4;
+ }
+
+ stream_Read( p_demux->s, p_fullheader, 4 ); /* CRC */
+ p_fullheader += 4;