pthread: Check memory allocation

This commit is contained in:
Vittorio Giovara 2015-05-31 14:55:06 +02:00 committed by Luca Barbato
parent 03927cb733
commit 0994e14213
1 changed files with 7 additions and 0 deletions

View File

@ -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;