Commit ff3bebc1 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

mkv: use a destructor to release all the resources allocated in an mkv_track_t

This way we can't forget any when releasing it from various places.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 25bb1708
......@@ -65,16 +65,6 @@ matroska_segment_c::matroska_segment_c( demux_sys_t & demuxer, EbmlStream & estr
matroska_segment_c::~matroska_segment_c()
{
for( tracks_map_t::iterator it = tracks.begin(); it != tracks.end(); ++it)
{
mkv_track_t & track = *it->second;
es_format_Clean( &track.fmt );
delete track.p_compression_data;
delete track.p_sys;
free( track.p_extra_data );
}
free( psz_writing_application );
free( psz_muxing_application );
free( psz_segment_filename );
......
......@@ -673,8 +673,6 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
if( p_track->i_number == 0 )
{
msg_Warn( &sys.demuxer, "Missing KaxTrackNumber, discarding track!" );
es_format_Clean( &p_track->fmt );
free(p_track->p_extra_data);
delete p_track;
return;
}
......@@ -688,8 +686,6 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
zlib_decompress_extra( &sys.demuxer, *p_track ) )
{
msg_Err(&sys.demuxer, "Couldn't handle the track %u compression", p_track->i_number );
es_format_Clean( &p_track->fmt );
free(p_track->p_extra_data);
delete p_track;
return;
}
......@@ -697,8 +693,6 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
if( !TrackInit( p_track ) )
{
msg_Err(&sys.demuxer, "Couldn't init track %u", p_track->i_number );
es_format_Clean( &p_track->fmt );
free(p_track->p_extra_data);
delete p_track;
return;
}
......@@ -708,8 +702,6 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
else
{
msg_Err( &sys.demuxer, "Track Entry %u not supported", p_track->i_number );
es_format_Clean( &p_track->fmt );
free(p_track->p_extra_data);
delete p_track;
}
}
......
......@@ -849,3 +849,14 @@ mkv_track_t::mkv_track_t(enum es_format_category_e es_cat) :
break;
}
}
mkv_track_t::~mkv_track_t()
{
es_format_Clean( &fmt );
assert(p_es == NULL); // did we leak an ES ?
free(p_extra_data);
delete p_compression_data;
delete p_sys;
}
......@@ -184,6 +184,7 @@ class mkv_track_t
{
public:
mkv_track_t(enum es_format_category_e es_cat);
~mkv_track_t();
typedef unsigned int track_id_t;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment