[vlc-devel] commit: Cleanup MP4 ftyp ( Rémi Denis-Courmont )

git version control git at videolan.org
Fri Mar 28 16:05:01 CET 2008


vlc | branch: 0.8.6-bugfix | Rémi Denis-Courmont <rem at videolan.org> | Sun Mar 16 23:16:58 2008 +0200| [4765bf1a8fc25819904c732df699703d596ba1fb]

Cleanup MP4 ftyp

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

 modules/demux/mp4/libmp4.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 544ef51..231e066 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -352,6 +352,7 @@ static int MP4_ReadBoxSkip( stream_t *p_stream, MP4_Box_t *p_box )
 
 static int MP4_ReadBox_ftyp( stream_t *p_stream, MP4_Box_t *p_box )
 {
+    unsigned code = 0;
     MP4_READBOX_ENTER( MP4_Box_data_ftyp_t );
 
     MP4_GETFOURCC( p_box->data.p_ftyp->i_major_brand );
@@ -360,8 +361,12 @@ 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 )
+            goto error;
 
         for( i =0; i < p_box->data.p_ftyp->i_compatible_brands_count; i++ )
         {
@@ -372,8 +377,10 @@ static int MP4_ReadBox_ftyp( stream_t *p_stream, MP4_Box_t *p_box )
     {
         p_box->data.p_ftyp->i_compatible_brands = NULL;
     }
+    code = 1;
 
-    MP4_READBOX_EXIT( 1 );
+error:
+    MP4_READBOX_EXIT( code );
 }
 
 static void MP4_FreeBox_ftyp( MP4_Box_t *p_box )




More information about the vlc-devel mailing list