ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@gmail.com> | Sun Feb 7 10:58:25 2021 +0100| [2ccbc40eefd22a6aac1e543ea849951e159f4d8a] | committer: Andreas Rheinhardt
avcodec/frame_thread_encoder: Fix segfault on allocation error Fixes a segfault from av_fifo_size(NULL) that happens in ff_frame_thread_encoder_free if the fifo couldn't be allocted; furthermore the mutexes and conditions that are destroyed in ff_frame_thread_encoder_free are not even initialized at this point, so don't call said function. Reviewed-by: Paul B Mahol <one...@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2ccbc40eefd22a6aac1e543ea849951e159f4d8a --- libavcodec/frame_thread_encoder.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/frame_thread_encoder.c b/libavcodec/frame_thread_encoder.c index ee289c90e3..9ca34e7ffb 100644 --- a/libavcodec/frame_thread_encoder.c +++ b/libavcodec/frame_thread_encoder.c @@ -182,8 +182,10 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options){ c->parent_avctx = avctx; c->task_fifo = av_fifo_alloc_array(BUFFER_SIZE, sizeof(Task)); - if(!c->task_fifo) - goto fail; + if (!c->task_fifo) { + av_freep(&avctx->internal->frame_thread_encoder); + return AVERROR(ENOMEM); + } pthread_mutex_init(&c->task_fifo_mutex, NULL); pthread_mutex_init(&c->finished_task_mutex, NULL); _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".