From 9f9d24c89a2286f952b123c703e8268d2f1aa719 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Sat, 23 Oct 2010 13:33:15 +0200 Subject: r600g: Fixed r600_vertex_element leak. Signed-off-by: Tilman Sauerbeck Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/evergreen_state.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/gallium/drivers/r600/evergreen_state.c') diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index f394527edfd..81241478ab2 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -561,13 +561,12 @@ static void evergreen_delete_state(struct pipe_context *ctx, void *state) static void evergreen_delete_vertex_element(struct pipe_context *ctx, void *state) { - struct r600_vertex_element *v = (struct r600_vertex_element*)state; + struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; - if (v == NULL) - return; - if (--v->refcount) - return; - free(v); + FREE(state); + + if (rctx->vertex_elements == state) + rctx->vertex_elements = NULL; } static void evergreen_set_clip_state(struct pipe_context *ctx, @@ -610,10 +609,8 @@ static void evergreen_bind_vertex_elements(struct pipe_context *ctx, void *state struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_vertex_element *v = (struct r600_vertex_element*)state; - evergreen_delete_vertex_element(ctx, rctx->vertex_elements); rctx->vertex_elements = v; if (v) { - v->refcount++; // rctx->vs_rebuild = TRUE; } } -- cgit v1.2.3