[vlc-devel] commit: Check a few mp4 mallocs. (Laurent Aimar )

git version control git at videolan.org
Thu Aug 21 19:09:03 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Aug 21 18:22:41 2008 +0200| [0bf165646d0dd39ad1bc698cdde0bbff1711e24d] | committer: Laurent Aimar 

Check a few mp4 mallocs.

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

 modules/demux/mp4/mp4.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index ffd20f6..d84f4f0 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -1270,6 +1270,9 @@ static int TrackCreateSamplesIndex( demux_t *p_demux,
         ck->p_sample_count_dts = calloc( i_entry, sizeof( uint32_t ) );
         ck->p_sample_delta_dts = calloc( i_entry, sizeof( uint32_t ) );
 
+        if( !ck->p_sample_count_dts || !ck->p_sample_delta_dts )
+            return VLC_ENOMEM;
+
         /* now copy */
         i_sample_count = ck->i_sample_count;
         for( i = 0; i < i_entry; i++ )
@@ -1333,6 +1336,8 @@ static int TrackCreateSamplesIndex( demux_t *p_demux,
             /* allocate them */
             ck->p_sample_count_pts = calloc( i_entry, sizeof( uint32_t ) );
             ck->p_sample_offset_pts = calloc( i_entry, sizeof( int32_t ) );
+            if( !ck->p_sample_count_pts || !ck->p_sample_offset_pts )
+                return VLC_ENOMEM;
 
             /* now copy */
             i_sample_count = ck->i_sample_count;




More information about the vlc-devel mailing list