diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index bbbc4829ec..2a11195e78 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -951,6 +951,10 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f) ff_thread_finish_setup(avctx); } + if (err) { + free_progress(f); + f->thread_opaque = NULL; + } pthread_mutex_unlock(&p->parent->buffer_mutex); return err;