[FFmpeg-cvslog] avcodec/ljpegenc: Check for av_malloc_array() failure
Michael Niedermayer
git at videolan.org
Sat Jan 3 21:43:09 CET 2015
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Jan 3 21:25:26 2015 +0100| [bd12aa2bc597f08409bede6d4c710eddf4d7c142] | committer: Michael Niedermayer
avcodec/ljpegenc: Check for av_malloc_array() failure
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bd12aa2bc597f08409bede6d4c710eddf4d7c142
---
libavcodec/ljpegenc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c
index 19ae151..1ace31b 100644
--- a/libavcodec/ljpegenc.c
+++ b/libavcodec/ljpegenc.c
@@ -293,6 +293,8 @@ static av_cold int ljpeg_encode_init(AVCodecContext *avctx)
avctx->coded_frame->key_frame = 1;
s->scratch = av_malloc_array(avctx->width + 1, sizeof(*s->scratch));
+ if (!s->scratch)
+ goto fail;
ff_idctdsp_init(&s->idsp, avctx);
ff_init_scantable(s->idsp.idct_permutation, &s->scantable,
@@ -310,6 +312,9 @@ static av_cold int ljpeg_encode_init(AVCodecContext *avctx)
avpriv_mjpeg_val_dc);
return 0;
+fail:
+ ljpeg_encode_close(avctx);
+ return AVERROR(ENOMEM);
}
AVCodec ff_ljpeg_encoder = {
More information about the ffmpeg-cvslog
mailing list