Signed-off-by: Giuseppe Bilotta <giuseppe.bilo...@gmail.com>
---
 src/mesa/main/pack.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index 760c46afe7..16bc95311b 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -1621,6 +1621,11 @@ _mesa_unpack_color_index_to_rgba_ubyte(struct gl_context 
*ctx, GLuint dims,
 
    count = srcWidth * srcHeight * srcDepth;
    dst = malloc(count * 4 * sizeof(GLubyte));
+   if (!dst) {
+      free(rgba);
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
+      return NULL;
+   }
    for (i = 0; i < count; i++) {
       CLAMPED_FLOAT_TO_UBYTE(dst[i * 4 + 0], rgba[i * 4 + 0]);
       CLAMPED_FLOAT_TO_UBYTE(dst[i * 4 + 1], rgba[i * 4 + 1]);
-- 
2.13.0.rc0.207.gb442654931

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to