You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
pthread: Check memory allocation
This commit is contained in:
committed by
Luca Barbato
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;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user