mesa: use malloc instead of MAX_WIDTH array in _mesa_convert_colors()
authorBrian Paul <brianp@vmware.com>
Tue, 6 Dec 2011 03:40:48 +0000 (20:40 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 8 Dec 2011 15:56:31 +0000 (08:56 -0700)
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/main/image.c

index b266e26c6795a21e917ea0abad2b38aa5622580c..f29b56647d0d4e7f781ad8f62b0d215ff0392c3d 100644 (file)
@@ -1520,9 +1520,13 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src,
                      GLenum dstType, GLvoid *dst,
                      GLuint count, const GLubyte mask[])
 {
-   GLuint tempBuffer[MAX_WIDTH][4];
+   GLuint *tempBuffer;
    const GLboolean useTemp = (src == dst);
 
+   tempBuffer = malloc(count * MAX_PIXEL_BYTES);
+   if (!tempBuffer)
+      return;
+
    ASSERT(srcType != dstType);
 
    switch (srcType) {
@@ -1624,6 +1628,8 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src,
    default:
       _mesa_problem(NULL, "Invalid datatype in _mesa_convert_colors");
    }
+
+   free(tempBuffer);
 }