Another malloc check
authorRémi Denis-Courmont <rem@videolan.org>
Sat, 1 Mar 2008 18:25:25 +0000 (18:25 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sat, 1 Mar 2008 18:25:25 +0000 (18:25 +0000)
modules/demux/mp4/libmp4.c

index 5d25e0f..01957ba 100644 (file)
@@ -377,12 +377,16 @@ static int MP4_ReadBox_ftyp( stream_t *p_stream, MP4_Box_t *p_box )
     if( ( p_box->data.p_ftyp->i_compatible_brands_count = i_read / 4 ) )
     {
         unsigned int i;
-        p_box->data.p_ftyp->i_compatible_brands =
-            calloc( p_box->data.p_ftyp->i_compatible_brands_count, sizeof(uint32_t));
+        uint32_t *tab = p_box->data.p_ftyp->i_compatible_brands =
+            calloc( p_box->data.p_ftyp->i_compatible_brands_count,
+                    sizeof(uint32_t));
+
+        if( tab == NULL )
+            p_box->data.p_ftyp->i_compatible_brands_count = 0;
 
         for( i =0; i < p_box->data.p_ftyp->i_compatible_brands_count; i++ )
         {
-            MP4_GETFOURCC( p_box->data.p_ftyp->i_compatible_brands[i] );
+            MP4_GETFOURCC( tab[i] );
         }
     }
     else