Commit 20c26b55 authored by François Grisez's avatar François Grisez
Browse files

Fix some memory leaks

parent a5bd997b
......@@ -163,6 +163,7 @@ static void stream_free(Stream *s) {
if(s->stream) {
stream_disconnect(s);
}
ms_free(s);
}
static bool_t stream_connect(Stream *s, StreamType type, pa_buffer_attr *attr) {
......
......@@ -46,7 +46,7 @@ static void _load_modules(nodemodule *modules);
struct _MKVTrackReader {
int track_num;
ebml_parser_context parser;
ebml_element *track_elt;
const ebml_element *track_elt;
ebml_element *current_cluster;
ebml_element *current_frame_elt;
stream *file;
......@@ -113,6 +113,7 @@ void mkv_reader_close(MKVReader *obj) {
if(obj->tracks) ms_list_free_with_data(obj->tracks, (void(*)(void *))_mkv_track_free);
ms_list_free_with_data(obj->readers, (void(*)(void *))_mkv_track_reader_destroy);
MATROSKA_Done((nodecontext *)&obj->p);
ParserContext_Done(&obj->p);
ms_free(obj);
}
}
......@@ -171,6 +172,7 @@ MKVTrackReader *mkv_reader_get_track_reader(MKVReader *reader, int track_num) {
Stream_Seek(track_reader->file, reader->first_cluster_pos, SEEK_SET);
track_reader->current_cluster = EBML_FindNextElement(track_reader->file, &track_reader->parser, &upper_levels, FALSE);
EBML_ElementReadData(track_reader->current_cluster, track_reader->file, &track_reader->parser, FALSE, SCOPE_PARTIAL_DATA, FALSE);
reader->readers = ms_list_append(reader->readers, track_reader);
return track_reader;
}
......@@ -460,6 +462,7 @@ static void _mkv_track_free(MKVTrack *obj) {
}
static void _mkv_track_reader_destroy(MKVTrackReader *obj) {
NodeDelete((node *)obj->current_cluster);
StreamClose(obj->file);
ms_free(obj);
}
......@@ -112,6 +112,7 @@ static void dec_uninit(MSFilter *f){
if (d->sps) freemsg(d->sps);
if (d->pps) freemsg(d->pps);
if (d->orig) av_frame_free(&d->orig);
if (d->sws_ctx) sws_freeContext(d->sws_ctx);
ms_free(d->bitstream);
ms_free(d);
}
......
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