diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index bbbc4829ec7155ca5b6fba50734f2e18fa5728f2..2a11195e7807058a09958b97477c41024ba3640a 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;