Merge commit '7ca603f96f93d988e01d161d611f69a4ecaa3f02'

* commit '7ca603f96f93d988e01d161d611f69a4ecaa3f02':
  jpegls: Check memory allocation

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-06-01 01:58:05 +02:00
commit 513673a84d
1 changed files with 6 additions and 0 deletions

View File

@ -349,10 +349,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;