[vlc-commits] AVI: abort on allocation failure
Rémi Denis-Courmont
git at videolan.org
Tue Jul 12 20:12:47 CEST 2011
vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 10 23:22:21 2011 +0300| [0d5af8cab21ab2acefc6e2c978a95ee0c6476565] | committer: Rémi Denis-Courmont
AVI: abort on allocation failure
(cherry picked from commit fb4754ad766a93452068416a5c9eca5b1bd632b4)
Conflicts:
modules/demux/avi/libavi.c
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=0d5af8cab21ab2acefc6e2c978a95ee0c6476565
---
modules/demux/avi/libavi.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/modules/demux/avi/libavi.c b/modules/demux/avi/libavi.c
index c92e1f1..f45a5dc 100644
--- a/modules/demux/avi/libavi.c
+++ b/modules/demux/avi/libavi.c
@@ -165,7 +165,7 @@ static int AVI_ChunkRead_list( stream_t *s, avi_chunk_t *p_container )
msg_Dbg( (vlc_object_t*)s, "<list \'%4.4s\'>", (char*)&p_container->list.i_type );
for( ; ; )
{
- p_chk = malloc( sizeof( avi_chunk_t ) );
+ p_chk = xmalloc( sizeof( avi_chunk_t ) );
memset( p_chk, 0, sizeof( avi_chunk_t ) );
if( !p_container->common.p_first )
{
@@ -338,7 +338,7 @@ static int AVI_ChunkRead_strf( stream_t *s, avi_chunk_t *p_chk )
{
case( AVIFOURCC_auds ):
p_chk->strf.auds.i_cat = AUDIO_ES;
- p_chk->strf.auds.p_wf = malloc( __MAX( p_chk->common.i_chunk_size, sizeof( WAVEFORMATEX ) ) );
+ p_chk->strf.auds.p_wf = xmalloc( __MAX( p_chk->common.i_chunk_size, sizeof( WAVEFORMATEX ) ) );
AVI_READ2BYTES( p_chk->strf.auds.p_wf->wFormatTag );
AVI_READ2BYTES( p_chk->strf.auds.p_wf->nChannels );
AVI_READ4BYTES( p_chk->strf.auds.p_wf->nSamplesPerSec );
@@ -386,7 +386,7 @@ static int AVI_ChunkRead_strf( stream_t *s, avi_chunk_t *p_chk )
case( AVIFOURCC_vids ):
p_strh->strh.i_samplesize = 0; /* XXX for ffmpeg avi file */
p_chk->strf.vids.i_cat = VIDEO_ES;
- p_chk->strf.vids.p_bih = malloc( __MAX( p_chk->common.i_chunk_size,
+ p_chk->strf.vids.p_bih = xmalloc( __MAX( p_chk->common.i_chunk_size,
sizeof( *p_chk->strf.vids.p_bih ) ) );
AVI_READ4BYTES( p_chk->strf.vids.p_bih->biSize );
AVI_READ4BYTES( p_chk->strf.vids.p_bih->biWidth );
@@ -442,7 +442,7 @@ static void AVI_ChunkFree_strf( avi_chunk_t *p_chk )
static int AVI_ChunkRead_strd( stream_t *s, avi_chunk_t *p_chk )
{
AVI_READCHUNK_ENTER;
- p_chk->strd.p_data = malloc( p_chk->common.i_chunk_size );
+ p_chk->strd.p_data = xmalloc( p_chk->common.i_chunk_size );
memcpy( p_chk->strd.p_data, p_buff + 8, p_chk->common.i_chunk_size );
AVI_READCHUNK_EXIT( VLC_SUCCESS );
}
@@ -464,7 +464,7 @@ static int AVI_ChunkRead_idx1( stream_t *s, avi_chunk_t *p_chk )
p_chk->idx1.i_entry_max = i_count;
if( i_count > 0 )
{
- p_chk->idx1.entry = calloc( i_count, sizeof( idx1_entry_t ) );
+ p_chk->idx1.entry = xcalloc( i_count, sizeof( idx1_entry_t ) );
for( i_index = 0; i_index < i_count ; i_index++ )
{
@@ -518,7 +518,7 @@ static int AVI_ChunkRead_indx( stream_t *s, avi_chunk_t *p_chk )
i_count = __MIN( p_indx->i_entriesinuse, i_read / 8 );
p_indx->i_entriesinuse = i_count;
- p_indx->idx.std = calloc( i_count, sizeof( indx_std_entry_t ) );
+ p_indx->idx.std = xcalloc( i_count, sizeof( indx_std_entry_t ) );
for( i = 0; i < i_count; i++ )
{
@@ -533,7 +533,7 @@ static int AVI_ChunkRead_indx( stream_t *s, avi_chunk_t *p_chk )
i_count = __MIN( p_indx->i_entriesinuse, i_read / 12 );
p_indx->i_entriesinuse = i_count;
- p_indx->idx.field = calloc( i_count, sizeof( indx_field_entry_t ) );
+ p_indx->idx.field = xcalloc( i_count, sizeof( indx_field_entry_t ) );
for( i = 0; i < i_count; i++ )
{
AVI_READ4BYTES( p_indx->idx.field[i].i_offset );
@@ -550,7 +550,7 @@ static int AVI_ChunkRead_indx( stream_t *s, avi_chunk_t *p_chk )
i_count = __MIN( p_indx->i_entriesinuse, i_read / 16 );
p_indx->i_entriesinuse = i_count;
- p_indx->idx.super = calloc( i_count, sizeof( indx_super_entry_t ) );
+ p_indx->idx.super = xcalloc( i_count, sizeof( indx_super_entry_t ) );
for( i = 0; i < i_count; i++ )
{
@@ -629,7 +629,7 @@ static int AVI_ChunkRead_strz( stream_t *s, avi_chunk_t *p_chk )
}
}
p_strz->p_type = strdup( AVI_strz_type[i_index].psz_type );
- p_strz->p_str = malloc( i_read + 1);
+ p_strz->p_str = xmalloc( i_read + 1);
if( p_strz->i_chunk_size )
{
@@ -864,7 +864,7 @@ int AVI_ChunkReadRoot( stream_t *s, avi_chunk_t *p_root )
for( ; ; )
{
- p_chk = malloc( sizeof( avi_chunk_t ) );
+ p_chk = xmalloc( sizeof( avi_chunk_t ) );
memset( p_chk, 0, sizeof( avi_chunk_t ) );
if( !p_root->common.p_first )
{
More information about the vlc-commits
mailing list