summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-07-05 03:21:27 +0900
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-07-05 03:51:26 +0900
commit152ed98b84acf500f4b5122cf3fde82c6e5206f2 (patch)
tree9955a97473bfe5048ca07547642b45ca96939c25
parentc23b64f1646ac5349c395ede47707906ddff7b4c (diff)
softpipe: Prevent NULL ptr derreference on takedown.
-rw-r--r--src/gallium/drivers/softpipe/sp_state_fs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c
index 24b91fbc79..901c8f83e7 100644
--- a/src/gallium/drivers/softpipe/sp_state_fs.c
+++ b/src/gallium/drivers/softpipe/sp_state_fs.c
@@ -154,8 +154,8 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
/* note: reference counting */
pipe_buffer_reference(ws,
&softpipe->constants[shader].buffer,
- buf->buffer);
- softpipe->constants[shader].size = buf->size;
+ buf ? buf->buffer : NULL);
+ softpipe->constants[shader].size = buf ? buf->size : 0;
softpipe->dirty |= SP_NEW_CONSTANTS;
}