Commit 245d0f18 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avformat/matroskadec: Fix memleaks in WebM DASH manifest demuxer

In certain error scenarios, the underlying Matroska demuxer was not
properly closed, causing leaks.
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
(cherry picked from commit 0841063ce6a2e664fb3986b0a255c57392cd9f02)
parent 0260352d
......@@ -4181,14 +4181,17 @@ static int webm_dash_manifest_read_header(AVFormatContext *s)
return -1;
}
if (!matroska->tracks.nb_elem || !s->nb_streams) {
matroska_read_close(s);
av_log(s, AV_LOG_ERROR, "No track found\n");
return AVERROR_INVALIDDATA;
ret = AVERROR_INVALIDDATA;
goto fail;
}
if (!matroska->is_live) {
buf = av_asprintf("%g", matroska->duration);
if (!buf) return AVERROR(ENOMEM);
if (!buf) {
ret = AVERROR(ENOMEM);
goto fail;
}
av_dict_set(&s->streams[0]->metadata, DURATION,
buf, AV_DICT_DONT_STRDUP_VAL);
......@@ -4211,7 +4214,7 @@ static int webm_dash_manifest_read_header(AVFormatContext *s)
ret = webm_dash_manifest_cues(s, init_range);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "Error parsing Cues\n");
return ret;
goto fail;
}
}
......@@ -4221,6 +4224,9 @@ static int webm_dash_manifest_read_header(AVFormatContext *s)
matroska->bandwidth, 0);
}
return 0;
fail:
matroska_read_close(s);
return ret;
}
static int webm_dash_manifest_read_packet(AVFormatContext *s, AVPacket *pkt)
......
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