summaryrefslogtreecommitdiff
path: root/libavcodec/jpeglsdec.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-05-31 14:54:11 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-05-31 15:03:31 +0200
commit7ca603f96f93d988e01d161d611f69a4ecaa3f02 (patch)
tree75b0b4ab81a68984536a006f18bdce60cd0bdbd6 /libavcodec/jpeglsdec.c
parent7d2a6826912b629f17f3b0c5268e334fa123c4c9 (diff)
jpegls: Check memory allocation
Diffstat (limited to 'libavcodec/jpeglsdec.c')
-rw-r--r--libavcodec/jpeglsdec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index d9b08fbb76..3b93799f85 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -278,10 +278,16 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
int off = 0, stride = 1, width, shift, ret = 0;
zero = av_mallocz(s->picture_ptr->linesize[0]);
+ if (!zero)
+ return AVERROR(ENOMEM);
last = zero;
cur = s->picture_ptr->data[0];
state = av_mallocz(sizeof(JLSState));
+ if (!state) {
+ av_free(zero);
+ return AVERROR(ENOMEM);
+ }
/* initialize JPEG-LS state from JPEG parameters */
state->near = near;
state->bpp = (s->bits < 2) ? 2 : s->bits;