summaryrefslogtreecommitdiff
path: root/libavcodec/kgv1dec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/kgv1dec.c')
-rw-r--r--libavcodec/kgv1dec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c
index ca639b7c5d..42bbcae530 100644
--- a/libavcodec/kgv1dec.c
+++ b/libavcodec/kgv1dec.c
@@ -61,8 +61,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
if (av_image_check_size(w, h, 0, avctx))
return -1;
- if (w != avctx->width || h != avctx->height)
+ if (w != avctx->width || h != avctx->height) {
+ if (c->prev.data[0])
+ avctx->release_buffer(avctx, &c->prev);
avcodec_set_dimensions(avctx, w, h);
+ }
maxcnt = w * h;