aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2013-06-15 22:11:55 +0300
committerLuca Barbato <lu_zero@gentoo.org>2013-06-16 15:10:58 +0200
commit985f34b75653d02eda8eb8def3412f8577f19b01 (patch)
treeed0fd1c7c6720aab34d90dc306de55d42b80ab86
parentdf9f22d42b0905385629a9d368bb5a1eef2b45ef (diff)
downloadffmpeg-985f34b75653d02eda8eb8def3412f8577f19b01.tar.gz
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@remlab.net> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r--libavcodec/utils.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index accb6b3a94..3dddafca10 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)