Browse code

pngdec.c : release allocated buffers.

Originally committed as revision 20680 to svn://svn.ffmpeg.org/ffmpeg/trunk

Jai Menon authored on 2009/12/01 20:38:37
Showing 1 changed files
... ...
@@ -642,6 +642,18 @@ static av_cold int png_dec_init(AVCodecContext *avctx){
642 642
     return 0;
643 643
 }
644 644
 
645
+static av_cold int png_dec_end(AVCodecContext *avctx)
646
+{
647
+    PNGDecContext *s = avctx->priv_data;
648
+
649
+    if (s->picture1.data[0])
650
+        avctx->release_buffer(avctx, &s->picture1);
651
+    if (s->picture2.data[0])
652
+        avctx->release_buffer(avctx, &s->picture2);
653
+
654
+    return 0;
655
+}
656
+
645 657
 AVCodec png_decoder = {
646 658
     "png",
647 659
     CODEC_TYPE_VIDEO,
... ...
@@ -649,7 +661,7 @@ AVCodec png_decoder = {
649 649
     sizeof(PNGDecContext),
650 650
     png_dec_init,
651 651
     NULL,
652
-    NULL, //decode_end,
652
+    png_dec_end,
653 653
     decode_frame,
654 654
     CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/,
655 655
     NULL,