[vlc-commits] demux: mp4: fix memleak on error
    Francois Cartegnie 
    git at videolan.org
       
    Sat Mar  7 20:07:56 CET 2015
    
    
  
vlc/vlc-2.2 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Mar  7 19:35:58 2015 +0100| [f4ec992034ceb5a8bd8a8bdeabd0fbfac12071b2] | committer: Jean-Baptiste Kempf
demux: mp4: fix memleak on error
(cherry picked from commit 849b1b27c224a8223a4aa0094db1c6d321733c86)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=f4ec992034ceb5a8bd8a8bdeabd0fbfac12071b2
---
 modules/demux/mp4/mp4.c |    4 ++++
 1 file changed, 4 insertions(+)
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 5253c5d..f108465 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -1946,6 +1946,8 @@ static int TrackCreateSamplesIndex( demux_t *p_demux,
             ck->p_sample_delta_dts = calloc( i_entry, sizeof( uint32_t ) );
             if( !ck->p_sample_count_dts || !ck->p_sample_delta_dts )
             {
+                free( ck->p_sample_count_dts );
+                free( ck->p_sample_delta_dts );
                 msg_Err( p_demux, "can't allocate memory for i_entry=%"PRIu32, i_entry );
                 return VLC_ENOMEM;
             }
@@ -2043,6 +2045,8 @@ static int TrackCreateSamplesIndex( demux_t *p_demux,
             ck->p_sample_offset_pts = calloc( i_entry, sizeof( int32_t ) );
             if( !ck->p_sample_count_pts || !ck->p_sample_offset_pts )
             {
+                free( ck->p_sample_count_pts );
+                free( ck->p_sample_offset_pts );
                 msg_Err( p_demux, "can't allocate memory for i_entry=%"PRIu32, i_entry );
                 return VLC_ENOMEM;
             }
    
    
More information about the vlc-commits
mailing list