mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-11 01:25:25 +00:00
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 <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
(cherry picked from commit 2ccbc40eef
)
This commit is contained in:
parent
515aa63e4d
commit
6ab290e20a
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user