From 6c1355be967751b194504ed73b053846fbae5fa9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 20 Feb 2015 21:08:10 +0100 Subject: demux: add free_demuxer_and_stream() function Although their lifetimes are conceptually different, it happens often that a demuxer is destroyed together with its stream. --- demux/demux_mkv_timeline.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'demux/demux_mkv_timeline.c') diff --git a/demux/demux_mkv_timeline.c b/demux/demux_mkv_timeline.c index 1a1816b93e..735678f7db 100644 --- a/demux/demux_mkv_timeline.c +++ b/demux/demux_mkv_timeline.c @@ -157,9 +157,8 @@ static int enable_cache(struct mpv_global *global, struct stream **stream, return 0; char *filename = talloc_strdup(NULL, (*demuxer)->filename); - free_demuxer(*demuxer); - free_stream(*stream); + free_demuxer_and_stream(*demuxer); *stream = stream_open(filename, global); if (!*stream) { talloc_free(filename); @@ -251,8 +250,7 @@ static bool check_file_seg(struct tl_ctx *ctx, struct demuxer ***sources, } } - free_demuxer(d); - free_stream(s); + free_demuxer_and_stream(d); return was_valid; } -- cgit v1.2.3