Mesa (master): mesa: use malloc instead of MAX_WIDTH array in _mesa_convert_colors()

Brian Paul brianp at kemper.freedesktop.org
Thu Dec 8 17:51:45 UTC 2011


Module: Mesa
Branch: master
Commit: 1614de4045c36ab6ec060e3bd0d1f3394d05b91e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1614de4045c36ab6ec060e3bd0d1f3394d05b91e

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Dec  5 20:40:48 2011 -0700

mesa: use malloc instead of MAX_WIDTH array in _mesa_convert_colors()

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/main/image.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index b266e26..f29b566 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -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);
 }
 
 




More information about the mesa-commit mailing list