[FFmpeg-cvslog] utils: fix avcodec_flush_buffers pre-reference counting compatibility
Janne Grunau
git at videolan.org
Mon Jun 17 00:27:43 CEST 2013
ffmpeg | branch: master | Janne Grunau <janne-libav at jannau.net> | Sat Jun 15 22:11:55 2013 +0300| [985f34b75653d02eda8eb8def3412f8577f19b01] | committer: 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: Rémi Denis-Courmont <remi at remlab.net>
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=985f34b75653d02eda8eb8def3412f8577f19b01
---
libavcodec/utils.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index accb6b3..3dddafc 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1804,6 +1804,9 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
ff_thread_flush(avctx);
else if (avctx->codec->flush)
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)
More information about the ffmpeg-cvslog
mailing list