summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-04-24 10:19:54 +0200
committerAnton Khirnov <anton@khirnov.net>2013-04-30 11:15:32 +0200
commite036bb7899d0faca9159206be9bf5552e76e7633 (patch)
tree2e0fe533bd60665c1a5aa3ac92ff65084046f572 /libavcodec/utils.c
parent3d10614529b0be529e73618e4f453f74f66c791b (diff)
lavc: clear AVBuffers on decoded frames if refcounted_frames is not set
Otherwise some code might mistakenly think it is allowed to unref those buffers, which would lead to double unref.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 32ca703389..67e5165143 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1407,6 +1407,7 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
if (!avctx->refcounted_frames) {
avci->to_free = *picture;
avci->to_free.extended_data = avci->to_free.data;
+ memset(picture->buf, 0, sizeof(picture->buf));
}
avctx->frame_number++;
@@ -1457,6 +1458,9 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
if (!avctx->refcounted_frames) {
avci->to_free = *frame;
avci->to_free.extended_data = avci->to_free.data;
+ memset(frame->buf, 0, sizeof(frame->buf));
+ frame->extended_buf = NULL;
+ frame->nb_extended_buf = 0;
}
}