[vlc-commits] demux: mp4: fix memleak on error

Francois Cartegnie git at videolan.org
Sat Mar 7 18:30:54 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Mar  7 18:26:31 2015 +0100| [849b1b27c224a8223a4aa0094db1c6d321733c86] | committer: Francois Cartegnie

demux: mp4: fix memleak on error

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

 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 f577454..21ad874 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -2102,6 +2102,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;
             }
@@ -2199,6 +2201,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