Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-01-03 23:25:26 +0300
committerMichael Niedermayer <michaelni@gmx.at>2015-01-03 23:25:26 +0300
commitbd12aa2bc597f08409bede6d4c710eddf4d7c142 (patch)
treec0771295d5bc16f766f9d4a9271c3846a36926c5 /libavcodec/ljpegenc.c
parentd56b0984f977dd82e5182593247b8984802db834 (diff)
avcodec/ljpegenc: Check for av_malloc_array() failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ljpegenc.c')
-rw-r--r--libavcodec/ljpegenc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c
index 19ae1517b9..1ace31b318 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 = {