summaryrefslogtreecommitdiffstats
path: root/libavcodec/huffyuv.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-19 20:19:38 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-02-19 20:32:02 +0100
commit4332b01c30a446e9c177fe44761a612daa0334c7 (patch)
treea7c9ed9f897954e0fe3ef02ae7664e9d2f2e041f /libavcodec/huffyuv.c
parenta88dee8eea191d8bd3bf00a0a82c0302ce10a7c5 (diff)
downloadffmpeg-streaming-4332b01c30a446e9c177fe44761a612daa0334c7.zip
ffmpeg-streaming-4332b01c30a446e9c177fe44761a612daa0334c7.tar.gz
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>
Diffstat (limited to 'libavcodec/huffyuv.c')
-rw-r--r--libavcodec/huffyuv.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
index 80b35ed..3866535 100644
--- a/libavcodec/huffyuv.c
+++ b/libavcodec/huffyuv.c
@@ -58,17 +58,11 @@ av_cold int ff_huffyuv_alloc_temp(HYuvContext *s)
{
int i;
- if (s->bitstream_bpp<24 || s->version > 2) {
- for (i=0; i<3; i++) {
- s->temp[i]= av_malloc(2*s->width + 16);
- 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])
+ for (i=0; i<3; i++) {
+ s->temp[i]= av_malloc(4*s->width + 16);
+ if (!s->temp[i])
return AVERROR(ENOMEM);
+ s->temp16[i] = (uint16_t*)s->temp[i];
}
return 0;
}
OpenPOWER on IntegriCloud