changeset 10412:9d31db7bec63 libavcodec

Release unreleased buffers found by make test.
author cehoyos
date Fri, 16 Oct 2009 14:50:08 +0000
parents db144278f288
children 8a137661f31e
files huffyuv.c mjpegdec.c pnmenc.c
diffstat 3 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/huffyuv.c	Fri Oct 16 12:35:49 2009 +0000
+++ b/huffyuv.c	Fri Oct 16 14:50:08 2009 +0000
@@ -1185,6 +1185,9 @@
     HYuvContext *s = avctx->priv_data;
     int i;
 
+    if (s->picture.data[0])
+        avctx->release_buffer(avctx, &s->picture);
+
     common_end(s);
     av_freep(&s->bitstream_buffer);
 
--- a/mjpegdec.c	Fri Oct 16 12:35:49 2009 +0000
+++ b/mjpegdec.c	Fri Oct 16 14:50:08 2009 +0000
@@ -1494,6 +1494,9 @@
     MJpegDecodeContext *s = avctx->priv_data;
     int i, j;
 
+    if (s->picture.data[0])
+        avctx->release_buffer(avctx, &s->picture);
+
     av_free(s->buffer);
     av_free(s->qscale_table);
 
--- a/pnmenc.c	Fri Oct 16 12:35:49 2009 +0000
+++ b/pnmenc.c	Fri Oct 16 14:50:08 2009 +0000
@@ -328,6 +328,15 @@
     return s->bytestream - s->bytestream_start;
 }
 
+static av_cold int common_end(AVCodecContext *avctx){
+    PNMContext *s = avctx->priv_data;
+
+    if (s->picture.data[0])
+        avctx->release_buffer(avctx, &s->picture);
+
+    return 0;
+}
+
 #if 0
 static int pnm_probe(AVProbeData *pd)
 {
@@ -371,7 +380,7 @@
     sizeof(PNMContext),
     common_init,
     NULL,
-    NULL,
+    common_end,
     pnm_decode_frame,
     CODEC_CAP_DR1,
     .pix_fmts= (const enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE},
@@ -400,7 +409,7 @@
     sizeof(PNMContext),
     common_init,
     NULL,
-    NULL,
+    common_end,
     pnm_decode_frame,
     CODEC_CAP_DR1,
     .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
@@ -429,7 +438,7 @@
     sizeof(PNMContext),
     common_init,
     NULL,
-    NULL,
+    common_end,
     pnm_decode_frame,
     CODEC_CAP_DR1,
     .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE},
@@ -458,7 +467,7 @@
     sizeof(PNMContext),
     common_init,
     NULL,
-    NULL,
+    common_end,
     pnm_decode_frame,
     CODEC_CAP_DR1,
     .pix_fmts= (const enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE},
@@ -487,7 +496,7 @@
     sizeof(PNMContext),
     common_init,
     NULL,
-    NULL,
+    common_end,
     pnm_decode_frame,
     CODEC_CAP_DR1,
     .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE},