[vlc-commits] mkv: fixed memory-leak related to mkv_track_t::fmt
Filip Roséen
git at videolan.org
Thu Sep 1 08:47:53 CEST 2016
vlc | branch: master | Filip Roséen <filip at atch.se> | Thu Sep 1 04:06:18 2016 +0200| [98086c479977d6f765762b6c9aa18c2742fb1e41] | committer: Thomas Guillem
mkv: fixed memory-leak related to mkv_track_t::fmt
If we do not insert the given track into our maps of tracks, we would
previously not invoke es_format_Clean on the given fmt, which of
course would leak dynamically allocated members.
There was also an issue with assigning values to data-members that
would later be overwritten, of course directly causing dynamically
allocated data to be leaked.
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=98086c479977d6f765762b6c9aa18c2742fb1e41
---
modules/demux/mkv/matroska_segment_parse.cpp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 7985656..7a410b3 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -207,9 +207,6 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
/* Init the track */
mkv_track_t track;
- track.fmt.psz_language = strdup("English");
- track.fmt.psz_description = NULL;
-
track.b_default = true;
track.b_enabled = true;
track.b_forced = false;
@@ -230,6 +227,10 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
std::memset( &track.fmt, 0, sizeof( track.fmt ) );
es_format_Init( &track.fmt, UNKNOWN_ES, 0 );
+
+ track.fmt.psz_language = strdup("English");
+ track.fmt.psz_description = NULL;
+
track.f_fps = 0;
track.p_es = NULL;
@@ -672,6 +673,7 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
else
{
msg_Err( &sys.demuxer, "Track Entry %u not supported", track.i_number );
+ es_format_Clean( &track.fmt );
free(track.p_extra_data);
}
}
More information about the vlc-commits
mailing list