[FFmpeg-cvslog] avcodec/ansi: Fix frame memleak
Michael Niedermayer
git at videolan.org
Tue Jun 6 01:08:03 EEST 2017
ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Mon May 29 14:07:33 2017 +0200| [8d1cd5fa08dde7cc825782f33708c115877ec3f5] | committer: Michael Niedermayer
avcodec/ansi: Fix frame memleak
Fixes: 1892/clusterfuzz-testcase-minimized-4519341733183488
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit e091b9b3c7859030f2896ca2ae96faa3afc694a1)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8d1cd5fa08dde7cc825782f33708c115877ec3f5
---
libavcodec/ansi.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index 98ea9e3d2a..31405b4a99 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -80,10 +80,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
AnsiContext *s = avctx->priv_data;
avctx->pix_fmt = AV_PIX_FMT_PAL8;
- s->frame = av_frame_alloc();
- if (!s->frame)
- return AVERROR(ENOMEM);
-
/* defaults */
s->font = avpriv_vga16_font;
s->font_height = 16;
@@ -98,6 +94,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "Invalid dimensions %d %d\n", avctx->width, avctx->height);
return AVERROR(EINVAL);
}
+
+ s->frame = av_frame_alloc();
+ if (!s->frame)
+ return AVERROR(ENOMEM);
+
return 0;
}
More information about the ffmpeg-cvslog
mailing list