[vlc-commits] mkv: Fix potential memory leaks

Hugo Beauzée-Luyssen git at videolan.org
Wed May 3 12:39:33 CEST 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed May  3 11:04:45 2017 +0200| [fa69b072d17fd9b4372aaa63014b9d09fd9a7e06] | committer: Hugo Beauzée-Luyssen

mkv: Fix potential memory leaks

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

 modules/demux/mkv/matroska_segment_parse.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 6d9ec9073c..d1b02f2c9a 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -695,6 +695,8 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
     if( track.i_number == 0 )
     {
         msg_Warn( &sys.demuxer, "Missing KaxTrackNumber, discarding track!" );
+        es_format_Clean( &track.fmt );
+        free(track.p_extra_data);
         return;
     }
 
@@ -705,11 +707,13 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
             track.i_encoding_scope & MATROSKA_ENCODING_SCOPE_PRIVATE &&
             track.i_extra_data && track.p_extra_data &&
             zlib_decompress_extra( &sys.demuxer, &track ) )
+            // zlib_decompress_extra will clean the track itself
             return;
 #endif
         if( TrackInit( &track ) )
         {
             msg_Err(&sys.demuxer, "Couldn't init track %u", track.i_number );
+            es_format_Clean( &track.fmt );
             free(track.p_extra_data);
             return;
         }



More information about the vlc-commits mailing list