[vlc-commits] demux: avi: add E_NOMEM returns

Francois Cartegnie git at videolan.org
Fri Apr 18 21:08:37 CEST 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Apr 18 20:08:59 2014 +0200| [6c0587c2f3b277197e46fdb041834df387bd1dac] | committer: Francois Cartegnie

demux: avi: add E_NOMEM returns

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6c0587c2f3b277197e46fdb041834df387bd1dac
---

 modules/demux/avi/libavi.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/modules/demux/avi/libavi.c b/modules/demux/avi/libavi.c
index 6be415d..d759770 100644
--- a/modules/demux/avi/libavi.c
+++ b/modules/demux/avi/libavi.c
@@ -338,6 +338,10 @@ 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 = xmalloc( __MAX( p_chk->common.i_chunk_size, sizeof( WAVEFORMATEX ) ) );
+            if ( !p_chk->strf.auds.p_wf )
+            {
+                AVI_READCHUNK_EXIT( VLC_ENOMEM );
+            }
             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 );
@@ -388,6 +392,10 @@ static int AVI_ChunkRead_strf( stream_t *s, avi_chunk_t *p_chk )
             p_chk->strf.vids.i_cat = VIDEO_ES;
             p_chk->strf.vids.p_bih = xmalloc( __MAX( p_chk->common.i_chunk_size,
                                          sizeof( *p_chk->strf.vids.p_bih ) ) );
+            if ( !p_chk->strf.vids.p_bih )
+            {
+                AVI_READCHUNK_EXIT( VLC_ENOMEM );
+            }
             AVI_READ4BYTES( p_chk->strf.vids.p_bih->biSize );
             AVI_READ4BYTES( p_chk->strf.vids.p_bih->biWidth );
             AVI_READ4BYTES( p_chk->strf.vids.p_bih->biHeight );



More information about the vlc-commits mailing list