diff options
author | Nicolas George <george@nsup.org> | 2013-12-29 10:49:01 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-01-07 21:28:41 +0100 |
commit | 4c3cd8814411aa20544f2baef72b5f3d4485a99c (patch) | |
tree | 0d9194dc9e8c577e01c5977845df4a92c445241d | |
parent | 4d70639d536da0574abeffc792d8f36e1fa62655 (diff) | |
download | ffmpeg-4c3cd8814411aa20544f2baef72b5f3d4485a99c.tar.gz |
lavc/diracdec: check av_frame_alloc() failure.
(cherry picked from commit a91394f4de63ae5c2e21c548045b79393ca7fea1)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/diracdec.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 9e2d263b5c..4990659812 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; } |