mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-31 20:02:42 +00:00
pthread: Check memory allocation
This commit is contained in:
parent
03927cb733
commit
0994e14213
@ -584,8 +584,15 @@ int ff_frame_thread_init(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
avctx->internal->thread_ctx = fctx = av_mallocz(sizeof(FrameThreadContext));
|
avctx->internal->thread_ctx = fctx = av_mallocz(sizeof(FrameThreadContext));
|
||||||
|
if (!fctx)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
fctx->threads = av_mallocz(sizeof(PerThreadContext) * thread_count);
|
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);
|
pthread_mutex_init(&fctx->buffer_mutex, NULL);
|
||||||
fctx->delaying = 1;
|
fctx->delaying = 1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user