makes things consistent
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -46,6 +46,7 @@ typedef struct DXVContext { · 45 unmodified lines | |||
| 46 | int64_t ctex_size; // Chroma texture size | 46 | int64_t ctex_size; // Chroma texture size |
| 47 | 47 | ||
| 48 | uint8_t *op_data[4]; // Opcodes | 48 | uint8_t *op_data[4]; // Opcodes |
| 49 | unsigned op_data_size[4]; | ||
| 49 | int64_t op_size[4]; // Opcodes size | 50 | 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 | } |