mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
jpegls: Check memory allocation
This commit is contained in:
parent
7d2a682691
commit
7ca603f96f
@ -278,10 +278,16 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
|
|||||||
int off = 0, stride = 1, width, shift, ret = 0;
|
int off = 0, stride = 1, width, shift, ret = 0;
|
||||||
|
|
||||||
zero = av_mallocz(s->picture_ptr->linesize[0]);
|
zero = av_mallocz(s->picture_ptr->linesize[0]);
|
||||||
|
if (!zero)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
last = zero;
|
last = zero;
|
||||||
cur = s->picture_ptr->data[0];
|
cur = s->picture_ptr->data[0];
|
||||||
|
|
||||||
state = av_mallocz(sizeof(JLSState));
|
state = av_mallocz(sizeof(JLSState));
|
||||||
|
if (!state) {
|
||||||
|
av_free(zero);
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
/* initialize JPEG-LS state from JPEG parameters */
|
/* initialize JPEG-LS state from JPEG parameters */
|
||||||
state->near = near;
|
state->near = near;
|
||||||
state->bpp = (s->bits < 2) ? 2 : s->bits;
|
state->bpp = (s->bits < 2) ? 2 : s->bits;
|
||||||
|
Loading…
Reference in New Issue
Block a user