From fcdbaf78f23f57f6c493efa9ec1689696db9a2d1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 12 Jan 2015 13:20:56 +0100 Subject: tl_matroska: fix minor memory leak in error case Going the way of least resistance. Fixes #1460. --- player/timeline/tl_matroska.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/player/timeline/tl_matroska.c b/player/timeline/tl_matroska.c index f303a6fabb..ae13f1973c 100644 --- a/player/timeline/tl_matroska.c +++ b/player/timeline/tl_matroska.c @@ -541,11 +541,13 @@ void build_ordered_chapter_timeline(struct MPContext *mpctx) } if (!part_count) { - // None of the parts come from the file itself??? - talloc_free(sources); - talloc_free(timeline); - talloc_free(chapters); - return; + // None of the parts come from the file itself??? + // Broken file, but we need at least 1 valid timeline part - add a dummy. + MP_WARN(mpctx, "Ordered chapters file with no parts?\n"); + struct timeline_part new = { + .source = demuxer, + }; + MP_TARRAY_APPEND(NULL, timeline, part_count, new); } struct timeline_part new = { -- cgit v1.2.3