diff --git a/libavcodec/rasc.c b/libavcodec/rasc.c index a8e00a41a6..5f956a9b2c 100644 --- a/libavcodec/rasc.c +++ b/libavcodec/rasc.c @@ -51,6 +51,8 @@ typedef struct RASCContext { GetByteContext gb; uint8_t *delta; int delta_size; + uint8_t *mv_scratch; + unsigned int mv_scratch_size; uint8_t *cursor; int cursor_size; unsigned cursor_w; @@ -294,10 +296,8 @@ static int decode_move(AVCodecContext *avctx, b2 -= s->frame2->linesize[0]; } } else if (type == 0) { - uint8_t *buffer; - - av_fast_padded_malloc(&s->delta, &s->delta_size, w * h * s->bpp); - buffer = s->delta; + av_fast_padded_malloc(&s->mv_scratch, &s->mv_scratch_size, w * h * s->bpp); + uint8_t *buffer = s->mv_scratch; if (!buffer) return AVERROR(ENOMEM); @@ -772,6 +772,8 @@ static av_cold int decode_close(AVCodecContext *avctx) s->cursor_size = 0; av_freep(&s->delta); s->delta_size = 0; + av_freep(&s->mv_scratch); + s->mv_scratch_size = 0; av_frame_free(&s->frame1); av_frame_free(&s->frame2); ff_inflate_end(&s->zstream);