avcodec/dnxhdenc: Use av_memdup() instead of av_malloc()+memcpy()

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-05-06 02:01:38 +02:00
parent eb583b3cb9
commit 3c1208be02

View File

@ -516,10 +516,9 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
ctx->thread[0] = ctx;
if (avctx->active_thread_type == FF_THREAD_SLICE) {
for (i = 1; i < avctx->thread_count; i++) {
ctx->thread[i] = av_malloc(sizeof(DNXHDEncContext));
ctx->thread[i] = av_memdup(ctx, sizeof(DNXHDEncContext));
if (!ctx->thread[i])
return AVERROR(ENOMEM);
memcpy(ctx->thread[i], ctx, sizeof(DNXHDEncContext));
}
}