Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2017-04-12 02:46:30 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2018-01-09 01:19:14 +0300
commitd6ecc61db8eabb24d5fa51619d84a1483cef5c8d (patch)
treefa7f99dbd296720493e4300d9a6855d25994991f
parent0bd6717c0fd348828f0464c86abf6028fb5fc8ab (diff)
avformat: Free the internal codec context at the end
Avoid a use after free in avformat_find_stream_info. (cherry picked from commit 9e4a5eb51b9f3b2bff0ef08e0074b7fe4893075d) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/utils.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3e59e50bb1..162eb5f4d2 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3737,12 +3737,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
}
- // close codecs which were opened in try_decode_frame()
- for (i = 0; i < ic->nb_streams; i++) {
- st = ic->streams[i];
- avcodec_close(st->internal->avctx);
- }
-
ff_rfps_calculate(ic);
for (i = 0; i < ic->nb_streams; i++) {
@@ -3923,6 +3917,7 @@ find_stream_info_err:
st = ic->streams[i];
if (st->info)
av_freep(&st->info->duration_error);
+ avcodec_close(ic->streams[i]->internal->avctx);
av_freep(&ic->streams[i]->info);
}
if (ic->pb)