kgv1: release reference picture on size change.
authorRonald S. Bultje <rsbultje@gmail.com>
Sat, 25 Feb 2012 00:27:53 +0000 (16:27 -0800)
committerRonald S. Bultje <rsbultje@gmail.com>
Sat, 25 Feb 2012 15:53:44 +0000 (07:53 -0800)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
libavcodec/kgv1dec.c

index ca639b7..42bbcae 100644 (file)
@@ -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;