summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2012-03-16 09:31:13 -0600
committerIan Romanick <ian.d.romanick@intel.com>2012-07-06 10:08:59 -0700
commit57a273d89b76c6fefc21438ed688a8b73d862cb4 (patch)
tree0e7912e2a49e50c9afc977719171ea7c923b7756
parent099bc3aaea93313c774a554a5dee56706ac4b674 (diff)
downloadmesa-57a273d89b76c6fefc21438ed688a8b73d862cb4.tar.gz
st/mesa: add null pointer check in st_texture_image_map()
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 <jfonseca@vmware.com> (cherry picked from commit 03f8a97d718502f60d16000aead251d88a751149)
-rw-r--r--src/mesa/state_tracker/st_texture.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 132d7a81c63..9627a61177c 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