diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index e0b5f527a3..9e11038c52 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -631,7 +631,7 @@ int ff_frame_thread_init(AVCodecContext *avctx) avctx->internal->thread_ctx = fctx = av_mallocz(sizeof(FrameThreadContext)); - fctx->threads = av_mallocz(sizeof(PerThreadContext) * thread_count); + fctx->threads = av_mallocz_array(thread_count, sizeof(PerThreadContext)); pthread_mutex_init(&fctx->buffer_mutex, NULL); fctx->delaying = 1;