Commit 6c07e41f authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/mjpegdec: check for malloc failure of blocks[] and last_nnz[]

Fixes null pointer dereference
Fixes Ticket2947
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 23bd0335
......@@ -507,6 +507,8 @@ unk_pixfmt:
av_freep(&s->last_nnz[i]);
s->blocks[i] = av_malloc(size * sizeof(**s->blocks));
s->last_nnz[i] = av_mallocz(size * sizeof(**s->last_nnz));
if (!s->blocks[i] || !s->last_nnz[i])
return AVERROR(ENOMEM);
s->block_stride[i] = bw * s->h_count[i];
}
memset(s->coefs_finished, 0, sizeof(s->coefs_finished));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment