Commit 50c8276e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Backport [24941] and [25157] memory error handling

parent f5cd18f8
...@@ -474,6 +474,8 @@ static int Open( vlc_object_t * p_this ) ...@@ -474,6 +474,8 @@ static int Open( vlc_object_t * p_this )
/* allocate memory */ /* allocate memory */
p_sys->track = calloc( p_sys->i_tracks, sizeof( mp4_track_t ) ); p_sys->track = calloc( p_sys->i_tracks, sizeof( mp4_track_t ) );
if( p_sys->track == NULL )
goto error;
memset( p_sys->track, 0, p_sys->i_tracks * sizeof( mp4_track_t ) ); memset( p_sys->track, 0, p_sys->i_tracks * sizeof( mp4_track_t ) );
/* now process each track and extract all usefull information */ /* now process each track and extract all usefull information */
...@@ -922,6 +924,10 @@ static int TrackCreateChunksIndex( demux_t *p_demux, ...@@ -922,6 +924,10 @@ static int TrackCreateChunksIndex( demux_t *p_demux,
} }
p_demux_track->chunk = calloc( p_demux_track->i_chunk_count, p_demux_track->chunk = calloc( p_demux_track->i_chunk_count,
sizeof( mp4_chunk_t ) ); sizeof( mp4_chunk_t ) );
if( p_demux_track->chunk == NULL )
{
return VLC_ENOMEM;
}
/* first we read chunk offset */ /* first we read chunk offset */
for( i_chunk = 0; i_chunk < p_demux_track->i_chunk_count; i_chunk++ ) for( i_chunk = 0; i_chunk < p_demux_track->i_chunk_count; i_chunk++ )
...@@ -1034,6 +1040,8 @@ static int TrackCreateSamplesIndex( demux_t *p_demux, ...@@ -1034,6 +1040,8 @@ static int TrackCreateSamplesIndex( demux_t *p_demux,
p_demux_track->i_sample_size = 0; p_demux_track->i_sample_size = 0;
p_demux_track->p_sample_size = p_demux_track->p_sample_size =
calloc( p_demux_track->i_sample_count, sizeof( uint32_t ) ); calloc( p_demux_track->i_sample_count, sizeof( uint32_t ) );
if( p_demux_track->p_sample_size == NULL )
return VLC_ENOMEM;
for( i_sample = 0; i_sample < p_demux_track->i_sample_count; i_sample++ ) for( i_sample = 0; i_sample < p_demux_track->i_sample_count; i_sample++ )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment