[FFmpeg-cvslog] avcodec/huffyuv: simplify allocation of temporaries

Michael Niedermayer git at videolan.org
Wed Feb 19 21:53:05 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Feb 19 20:19:38 2014 +0100| [4332b01c30a446e9c177fe44761a612daa0334c7] | committer: Michael Niedermayer

avcodec/huffyuv: simplify allocation of temporaries

This also fixes a null pointer dereference with rgb and plane prediction

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4332b01c30a446e9c177fe44761a612daa0334c7
---

 libavcodec/huffyuv.c |   14 ++++----------
 1 file 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;
 }



More information about the ffmpeg-cvslog mailing list