[FFmpeg-devel] [PATCH 4/7] lavc/diracdec: check av_frame_alloc() failure.
Nicolas George
george at nsup.org
Sun Dec 29 11:11:45 CET 2013
Signed-off-by: Nicolas George <george at nsup.org>
---
libavcodec/diracdec.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
echo 'AVCodec.cleanup()' >> TODO
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 5eca4f6..d437e14 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;
}
--
1.8.5.2
More information about the ffmpeg-devel
mailing list