mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-18 13:21:08 +00:00
avcodec/huffyuv: simplify allocation of temporaries
This also fixes a null pointer dereference with rgb and plane prediction Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
a88dee8eea
commit
4332b01c30
@ -58,17 +58,11 @@ av_cold int ff_huffyuv_alloc_temp(HYuvContext *s)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (s->bitstream_bpp<24 || s->version > 2) {
|
for (i=0; i<3; i++) {
|
||||||
for (i=0; i<3; i++) {
|
s->temp[i]= av_malloc(4*s->width + 16);
|
||||||
s->temp[i]= av_malloc(2*s->width + 16);
|
if (!s->temp[i])
|
||||||
if (!s->temp[i])
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
s->temp16[i] = (uint16_t*)s->temp[i];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
s->temp[0]= av_mallocz(4*s->width + 16);
|
|
||||||
if (!s->temp[0])
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
s->temp16[i] = (uint16_t*)s->temp[i];
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user