Commit 985f34b7 authored by Janne Grunau's avatar Janne Grunau Committed by Luca Barbato

utils: fix avcodec_flush_buffers pre-reference counting compatibility

The to_free AVframe must be freed just like the other ones.
Indeed, the calling application may expect all frames to be
released.

(This regression caused use-after-free in VLC with hwaccel.)
Signed-off-by: 's avatarRémi Denis-Courmont <remi@remlab.net>
Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent df9f22d4
...@@ -1804,6 +1804,9 @@ void avcodec_flush_buffers(AVCodecContext *avctx) ...@@ -1804,6 +1804,9 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
ff_thread_flush(avctx); ff_thread_flush(avctx);
else if (avctx->codec->flush) else if (avctx->codec->flush)
avctx->codec->flush(avctx); avctx->codec->flush(avctx);
if (!avctx->refcounted_frames)
av_frame_unref(&avctx->internal->to_free);
} }
int av_get_exact_bits_per_sample(enum AVCodecID codec_id) int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
......
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