flashsv: only realloc blocks for version 2
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 15 Nov 2012 19:56:28 +0000 (20:56 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 15 Nov 2012 19:58:35 +0000 (20:58 +0100)
Fixes 10l regression introducing a memleak

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/flashsv.c

index 27f5dce..9e13ea6 100644 (file)
@@ -322,9 +322,10 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
         s->keyframedata = av_realloc(s->keyframedata, avpkt->size);
         memcpy(s->keyframedata, avpkt->data, avpkt->size);
     }
-    s->blocks = av_realloc(s->blocks,
-                            (v_blocks + !!v_part) * (h_blocks + !!h_part)
-                            * sizeof(s->blocks[0]));
+    if(s->ver == 2)
+        s->blocks = av_realloc(s->blocks,
+                                (v_blocks + !!v_part) * (h_blocks + !!h_part)
+                                * sizeof(s->blocks[0]));
 
     av_dlog(avctx, "image: %dx%d block: %dx%d num: %dx%d part: %dx%d\n",
             s->image_width, s->image_height, s->block_width, s->block_height,