mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
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.
This commit is contained in:
parent
3d10614529
commit
e036bb7899
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user