vlc | branch: master | Filip Roséen <[email protected]> | Fri Sep 23 15:43:09 2016 
+0200| [8d9946527b4b364a2109653b25905c9881426b06] | committer: Thomas Guillem

demux/mkv: fix memory-leak during seek

The diff should speak for itself, but we should of course not break
out of the loop before we had the opportunity to free the allocated
memory within it.

fixes #17425

Signed-off-by: Thomas Guillem <[email protected]>

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

 modules/demux/mkv/matroska_segment_seeker.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment_seeker.cpp 
b/modules/demux/mkv/matroska_segment_seeker.cpp
index de18242..73a2d16 100644
--- a/modules/demux/mkv/matroska_segment_seeker.cpp
+++ b/modules/demux/mkv/matroska_segment_seeker.cpp
@@ -326,18 +326,18 @@ SegmentSeeker::index_unsearched_range( 
matroska_segment_c& ms, Range search_area
             block_pts = block->GlobalTimecode() / 1000;
         }
 
-        if( ! ms.FindTrackByBlock( &i_track, block, simpleblock ) )
+        bool const b_valid_track = !ms.FindTrackByBlock( &i_track, block, 
simpleblock );
+
+        delete block;
+
+        if( b_valid_track )
         {
             if( b_key_picture )
-            {
                 add_seekpoint( i_track->first, Seekpoint::TRUSTED, block_pos, 
block_pts );
-            }
 
             if( max_pts < block_pts )
                 break;
         }
-
-        delete block;
     }
 
     search_area.end = ms.es.I_O().getFilePointer();

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to