diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c index 5037bb8e02..a9f6e20f3a 100644 --- a/libavcodec/proresdec2.c +++ b/libavcodec/proresdec2.c @@ -202,6 +202,7 @@ static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, cons if (ctx->slice_count != slice_count || !ctx->slices) { av_freep(&ctx->slices); + ctx->slice_count = 0; ctx->slices = av_mallocz(slice_count * sizeof(*ctx->slices)); if (!ctx->slices) return AVERROR(ENOMEM);