From 03f8a97d718502f60d16000aead251d88a751149 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 16 Mar 2012 09:31:13 -0600 Subject: [PATCH] st/mesa: add null pointer check in st_texture_image_map() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If we failed to allocate a memory resource for the texture we'd crash when we tried to map it. Now we propogate the NULL back up to the texstore code and generate GL_OUT_OF_MEMORY. Fixes a crash with the upcoming piglit max-texture-size test. NOTE: This is a candidate for the 8.0 branch. Reviewed-by: José Fonseca --- src/mesa/state_tracker/st_texture.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 132d7a8..9627a61 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -222,6 +222,9 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, DBG("%s \n", __FUNCTION__); + if (!stImage->pt) + return NULL; + if (stObj->pt != stImage->pt) level = 0; else -- 2.7.4