diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2025-08-08 12:43:46 +0200 |
---|---|---|
committer | michaelni <michael@niedermayer.cc> | 2025-08-13 10:12:07 +0000 |
commit | 373bd80b16643e349d229e2479fad565dba129a5 (patch) | |
tree | 6c47e1d47d1169258ce8d92712045b889aad18e5 | |
parent | 4e5f25c0a50ac17e20ddc3549dbff0976a5826b9 (diff) | |
download | ffmpeg-373bd80b16643e349d229e2479fad565dba129a5.tar.gz |
avcodec/dxv: Use av_fast_realloc() for op_data
makes things consistent
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/dxv.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c index 052fe0ac6c..dd82e450b1 100644 --- a/libavcodec/dxv.c +++ b/libavcodec/dxv.c @@ -46,6 +46,7 @@ typedef struct DXVContext { int64_t ctex_size; // Chroma texture size uint8_t *op_data[4]; // Opcodes + unsigned op_data_size[4]; int64_t op_size[4]; // Opcodes size } DXVContext; @@ -1003,9 +1004,11 @@ static int dxv_decode(AVCodecContext *avctx, AVFrame *frame, memset(ctx->ctex_data + old_size, 0, ctx->ctex_data_size - old_size); for (i = 0; i < 4; i++) { - ret = av_reallocp(&ctx->op_data[i], ctx->op_size[i]); - if (ret < 0) - return ret; + old_size = ctx->op_data_size[i]; + ptr = av_fast_realloc(ctx->op_data[i], &ctx->op_data_size[i], ctx->op_size[i]); + if (!ptr) + return AVERROR(ENOMEM); + ctx->op_data[i] = ptr; } } @@ -1101,6 +1104,7 @@ static av_cold int dxv_close(AVCodecContext *avctx) av_freep(&ctx->op_data[1]); av_freep(&ctx->op_data[2]); av_freep(&ctx->op_data[3]); + memset(ctx->op_data_size, 0, sizeof(ctx->op_data_size)); return 0; } |