[FFmpeg-cvslog] lavc/anm: fix mem leak in case of init failure

Lukasz Marek git at videolan.org
Sun Nov 23 03:35:10 CET 2014


ffmpeg | branch: master | Lukasz Marek <lukasz.m.luki2 at gmail.com> | Sat Nov 22 22:41:35 2014 +0100| [691f9be622c73c5743f38ba494eabc67aa5f43a6] | committer: Lukasz Marek

lavc/anm: fix mem leak in case of init failure

Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=691f9be622c73c5743f38ba494eabc67aa5f43a6
---

 libavcodec/anm.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/anm.c b/libavcodec/anm.c
index 79a87dd..3727534 100644
--- a/libavcodec/anm.c
+++ b/libavcodec/anm.c
@@ -47,8 +47,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
         return AVERROR(ENOMEM);
 
     bytestream2_init(&s->gb, avctx->extradata, avctx->extradata_size);
-    if (bytestream2_get_bytes_left(&s->gb) < 16 * 8 + 4 * 256)
+    if (bytestream2_get_bytes_left(&s->gb) < 16 * 8 + 4 * 256) {
+        av_frame_free(&s->frame);
         return AVERROR_INVALIDDATA;
+    }
 
     bytestream2_skipu(&s->gb, 16 * 8);
     for (i = 0; i < 256; i++)



More information about the ffmpeg-cvslog mailing list