[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:59 2015 +0100| [76bd2a9cbca1b0cb7a017477200787804f25bd82] | committer: Jean-Baptiste Kempf

demux: mp4: fix memleak on error

(cherry picked from commit 8f0ad2f30f7de6b8e9b10f372c2a9e49b4a35d25)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=76bd2a9cbca1b0cb7a017477200787804f25bd82
---

 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 f108465..6ff256b 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -4058,7 +4058,11 @@ static int MP4_frg_GetChunk( demux_t *p_demux, MP4_Box_t *p_chunk, unsigned *i_t
     ret->p_sample_delta_dts = calloc( ret->i_sample_count, sizeof( uint32_t ) );
 
     if( !ret->p_sample_count_dts || !ret->p_sample_delta_dts )
+    {
+        free( ret->p_sample_count_dts );
+        free( ret->p_sample_delta_dts );
         return VLC_ENOMEM;
+    }
 
     ret->p_sample_count_pts = calloc( ret->i_sample_count, sizeof( uint32_t ) );
     if( !ret->p_sample_count_pts )



More information about the vlc-commits mailing list