diff mbox series

[FFmpeg-devel,22/23] avcodec/dnxhdenc: Use av_memdup() instead of av_malloc()+memcpy()

Message ID VI1PR0301MB215922AF19D376F2168AF9058F589@VI1PR0301MB2159.eurprd03.prod.outlook.com
State Accepted
Commit 3c1208be0201785e7e9786aecd40916f9396f8cc
Headers show
Series [FFmpeg-devel,01/23] avcodec/ljpegenc: Mark encoder as init-threadsafe
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt May 6, 2021, 5:11 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/dnxhdenc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 1df5346e62..1a59815472 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -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));
         }
     }