[vlc-commits] demux/mkv: fix memory-leak on unknown elements
Filip Roséen
git at videolan.org
Thu Jan 19 12:03:08 CET 2017
vlc | branch: master | Filip Roséen <filip at atch.se> | Thu Jan 12 13:31:08 2017 +0100| [948ceef01695e7cbf14b76111356126659df6561] | committer: Jean-Baptiste Kempf
demux/mkv: fix memory-leak on unknown elements
If the read element is not a KaxSegment we do not store it anywhere,
as such it will be leaked when we either read a new element, or assign
NULL to p_l0 to signal that we should abort parsing.
These additions make sure that we delete non-handled elements, effectively
preventing leaks of such elements.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=948ceef01695e7cbf14b76111356126659df6561
---
modules/demux/mkv/demux.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp
index 481aa0d..56248e8 100644
--- a/modules/demux/mkv/demux.cpp
+++ b/modules/demux/mkv/demux.cpp
@@ -502,6 +502,8 @@ matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlS
while (p_l0 != 0)
{
+ bool b_l0_handled = false;
+
if ( MKV_IS_ID( p_l0, KaxSegment) )
{
EbmlParser *ep;
@@ -577,7 +579,12 @@ matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlS
p_segment1->segment = NULL;
delete p_segment1;
}
+
+ b_l0_handled = true;
}
+
+ EbmlElement* p_l0_prev = p_l0;
+
if (p_l0->IsFiniteSize() )
{
p_l0->SkipData(*p_estream, KaxMatroska_Context);
@@ -587,6 +594,9 @@ matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlS
{
p_l0 = NULL;
}
+
+ if( b_l0_handled == false )
+ delete p_l0_prev;
}
if ( !b_keep_stream )
More information about the vlc-commits
mailing list