diff mbox series

[FFmpeg-devel,2/2] avcodec/proresenc_kostya: Use av_calloc/av_malloc_array()

Message ID AM7PR03MB6660127A6605334760228F938F2D9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit fb36af3b66efab15b5a58f66acfd3425b06166dd
Headers show
Series [FFmpeg-devel,1/2] avcodec/proresenc_kostya: Cleanup generically after init failure | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 8, 2022, 10:38 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/proresenc_kostya.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
index 08a874dd4e..beceee621d 100644
--- a/libavcodec/proresenc_kostya.c
+++ b/libavcodec/proresenc_kostya.c
@@ -1273,18 +1273,18 @@  static av_cold int encode_init(AVCodecContext *avctx)
             }
         }
 
-        ctx->slice_q = av_malloc(ctx->slices_per_picture * sizeof(*ctx->slice_q));
+        ctx->slice_q = av_malloc_array(ctx->slices_per_picture, sizeof(*ctx->slice_q));
         if (!ctx->slice_q)
             return AVERROR(ENOMEM);
 
-        ctx->tdata = av_mallocz(avctx->thread_count * sizeof(*ctx->tdata));
+        ctx->tdata = av_calloc(avctx->thread_count, sizeof(*ctx->tdata));
         if (!ctx->tdata)
             return AVERROR(ENOMEM);
 
         for (j = 0; j < avctx->thread_count; j++) {
-            ctx->tdata[j].nodes = av_malloc((ctx->slices_width + 1)
-                                            * TRELLIS_WIDTH
-                                            * sizeof(*ctx->tdata->nodes));
+            ctx->tdata[j].nodes = av_malloc_array(ctx->slices_width + 1,
+                                                  TRELLIS_WIDTH
+                                                  * sizeof(*ctx->tdata->nodes));
             if (!ctx->tdata[j].nodes)
                 return AVERROR(ENOMEM);
             for (i = min_quant; i < max_quant + 2; i++) {