summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2012-04-25 11:41:13 +0100
committerJosé Fonseca <jfonseca@vmware.com>2012-04-25 11:41:13 +0100
commit63da1aa5be4aa3e14a0456daf863c1bf10de619f (patch)
treed2fdc25740a4955d8bbfa34f10b2cc97e04f87d7 /src/mesa/state_tracker
parent1781d26faa6bf13950b95be97b6510e8f13290d6 (diff)
downloadexternal_mesa3d-63da1aa5be4aa3e14a0456daf863c1bf10de619f.zip
external_mesa3d-63da1aa5be4aa3e14a0456daf863c1bf10de619f.tar.gz
external_mesa3d-63da1aa5be4aa3e14a0456daf863c1bf10de619f.tar.bz2
mesa/st: Fix derreference after free.
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_context.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 84aae81..19d9da1 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -270,6 +270,7 @@ static void st_destroy_context_priv( struct st_context *st )
void st_destroy_context( struct st_context *st )
{
struct pipe_context *pipe = st->pipe;
+ struct u_vbuf *vbuf = st->vbuf;
struct cso_context *cso = st->cso_context;
struct gl_context *ctx = st->ctx;
GLuint i;
@@ -300,10 +301,13 @@ void st_destroy_context( struct st_context *st )
_mesa_free_context_data(ctx);
+ /* This will free the st_context too, so 'st' must not be accessed
+ * afterwards. */
st_destroy_context_priv(st);
+ st = NULL;
- if (st->vbuf)
- u_vbuf_destroy(st->vbuf);
+ if (vbuf)
+ u_vbuf_destroy(vbuf);
cso_destroy_context(cso);