aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/diracdec.c
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2013-12-29 10:49:01 +0100
committerNicolas George <george@nsup.org>2013-12-30 10:58:01 +0100
commita91394f4de63ae5c2e21c548045b79393ca7fea1 (patch)
tree98b5e0e6acabfaa82ec53d5333f4a1658b6ab8df /libavcodec/diracdec.c
parent38004051b53ddecb518053e6dadafa9adc4fc1b2 (diff)
downloadffmpeg-a91394f4de63ae5c2e21c548045b79393ca7fea1.tar.gz
lavc/diracdec: check av_frame_alloc() failure.
Diffstat (limited to 'libavcodec/diracdec.c')
-rw-r--r--libavcodec/diracdec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 5eca4f6fad..d437e14ce5 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;
}