History

avcodec/dxv: Use av_fast_realloc() for op_data

makes things consistent

Michael Niedermayer committed 1 year ago

Commit 23655161 parent f2507db1 file · +7 −3Browse files

Unified · Split

libavcodec/dxv.c+7−3
@@ -46,6 +46,7 @@ typedef struct DXVContext { · 45 unmodified lines
46 int64_t ctex_size; // Chroma texture size46 int64_t ctex_size; // Chroma texture size
47 47
48 uint8_t *op_data[4]; // Opcodes48 uint8_t *op_data[4]; // Opcodes
49 unsigned op_data_size[4];
49 int64_t op_size[4]; // Opcodes size50 int64_t op_size[4]; // Opcodes size
50} DXVContext;51} DXVContext;
51 52
@@ -1003,9 +1004,11 @@ static int dxv_decode(AVCodecContext *avctx, AVFrame *frame, · 951 unmodified lines
1003 memset(ctx->ctex_data + old_size, 0, ctx->ctex_data_size - old_size);1004 memset(ctx->ctex_data + old_size, 0, ctx->ctex_data_size - old_size);
1004 1005
1005 for (i = 0; i < 4; i++) {1006 for (i = 0; i < 4; i++) {
1006 ret = av_reallocp(&ctx->op_data[i], ctx->op_size[i]);1007 old_size = ctx->op_data_size[i];
1007 if (ret < 0)1008 ptr = av_fast_realloc(ctx->op_data[i], &ctx->op_data_size[i], ctx->op_size[i]);
1008 return ret;1009 if (!ptr)
1010 return AVERROR(ENOMEM);
1011 ctx->op_data[i] = ptr;
1009 }1012 }
1010 }1013 }
1011 1014
@@ -1101,6 +1104,7 @@ static av_cold int dxv_close(AVCodecContext *avctx) · 89 unmodified lines
1101 av_freep(&ctx->op_data[1]);1104 av_freep(&ctx->op_data[1]);
1102 av_freep(&ctx->op_data[2]);1105 av_freep(&ctx->op_data[2]);
1103 av_freep(&ctx->op_data[3]);1106 av_freep(&ctx->op_data[3]);
1107 memset(ctx->op_data_size, 0, sizeof(ctx->op_data_size));
1104 1108
1105 return 0;1109 return 0;
1106}1110}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t