[vlc-commits] mp4 demux: fix crash

Rafaël Carré git at videolan.org
Sun Oct 14 19:42:40 CEST 2012


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Sun Oct 14 19:41:42 2012 +0200| [30cfbde30e0849fa66a61f72d57055b99072fbda] | committer: Rafaël Carré

mp4 demux: fix crash

Don't call with NULL
Remove unused return value

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

 modules/demux/mp4/mp4.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 1c1d139..3aeab29 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -2663,7 +2663,7 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
 #endif
 }
 
-static int FreeAndResetChunk( mp4_chunk_t *ck )
+static void FreeAndResetChunk( mp4_chunk_t *ck )
 {
     free( ck->p_sample_count_dts );
     free( ck->p_sample_delta_dts );
@@ -2674,7 +2674,6 @@ static int FreeAndResetChunk( mp4_chunk_t *ck )
         free( ck->p_sample_data[i] );
     free( ck->p_sample_data );
     memset( ck, 0, sizeof( mp4_chunk_t ) );
-    return VLC_SUCCESS;
 }
 
 /****************************************************************************
@@ -2704,8 +2703,10 @@ static void MP4_TrackDestroy( mp4_track_t *p_track )
         }
     }
     FREENULL( p_track->chunk );
-    FreeAndResetChunk( p_track->cchunk );
-    FREENULL( p_track->cchunk );
+    if( p_track->cchunk ) {
+        FreeAndResetChunk( p_track->cchunk );
+        FREENULL( p_track->cchunk );
+    }
 
     if( !p_track->i_sample_size )
     {



More information about the vlc-commits mailing list