mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-17 20:40:07 +01:00
avformat: Free the internal codec context at the end
Avoid a use after free in avformat_find_stream_info.
(cherry picked from commit 9e4a5eb51b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
0bd6717c0f
commit
d6ecc61db8
@@ -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);
|
ff_rfps_calculate(ic);
|
||||||
|
|
||||||
for (i = 0; i < ic->nb_streams; i++) {
|
for (i = 0; i < ic->nb_streams; i++) {
|
||||||
@@ -3923,6 +3917,7 @@ find_stream_info_err:
|
|||||||
st = ic->streams[i];
|
st = ic->streams[i];
|
||||||
if (st->info)
|
if (st->info)
|
||||||
av_freep(&st->info->duration_error);
|
av_freep(&st->info->duration_error);
|
||||||
|
avcodec_close(ic->streams[i]->internal->avctx);
|
||||||
av_freep(&ic->streams[i]->info);
|
av_freep(&ic->streams[i]->info);
|
||||||
}
|
}
|
||||||
if (ic->pb)
|
if (ic->pb)
|
||||||
|
|||||||
Reference in New Issue
Block a user