[FFmpeg-cvslog] lavc/diracdec: check av_frame_alloc() failure.
Nicolas George
git at videolan.org
Tue Jan 7 21:35:32 CET 2014
ffmpeg | branch: release/2.1 | Nicolas George <george at nsup.org> | Sun Dec 29 10:49:01 2013 +0100| [4c3cd8814411aa20544f2baef72b5f3d4485a99c] | committer: Michael Niedermayer
lavc/diracdec: check av_frame_alloc() failure.
(cherry picked from commit a91394f4de63ae5c2e21c548045b79393ca7fea1)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c3cd8814411aa20544f2baef72b5f3d4485a99c
---
libavcodec/diracdec.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 9e2d263..4990659 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -406,8 +406,14 @@ static av_cold int dirac_decode_init(AVCodecContext *avctx)
ff_dsputil_init(&s->dsp, avctx);
ff_diracdsp_init(&s->diracdsp);
- for (i = 0; i < MAX_FRAMES; i++)
+ for (i = 0; i < MAX_FRAMES; i++) {
s->all_frames[i].avframe = av_frame_alloc();
+ if (!s->all_frames[i].avframe) {
+ while (i > 0)
+ av_frame_free(&s->all_frames[--i].avframe);
+ return AVERROR(ENOMEM);
+ }
+ }
return 0;
}
More information about the ffmpeg-cvslog
mailing list