Commit 0994e142 authored by Vittorio Giovara's avatar Vittorio Giovara Committed by Luca Barbato

pthread: Check memory allocation

parent 03927cb7
......@@ -584,8 +584,15 @@ int ff_frame_thread_init(AVCodecContext *avctx)
}
avctx->internal->thread_ctx = fctx = av_mallocz(sizeof(FrameThreadContext));
if (!fctx)
return AVERROR(ENOMEM);
fctx->threads = av_mallocz(sizeof(PerThreadContext) * thread_count);
if (!fctx->threads) {
av_freep(&avctx->internal->thread_ctx);
return AVERROR(ENOMEM);
}
pthread_mutex_init(&fctx->buffer_mutex, NULL);
fctx->delaying = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment