aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_query.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-02-23 22:45:45 +0100
committerMarek Olšák <[email protected]>2012-03-05 14:22:19 +0100
commiteabcecc26baf225dc50f1d400a80ea4c78831390 (patch)
tree2dfd3669de7146eddfe6f4ba77020ea23321ee67 /src/gallium/drivers/r600/r600_query.c
parent83667acfd9feed932f6864092382e752466975ed (diff)
r600g: release query buffers in destroy_query
This fixes a memory leak introduced with the rework. Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_query.c')
-rw-r--r--src/gallium/drivers/r600/r600_query.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c
index a896f03b0d8..25731c290f6 100644
--- a/src/gallium/drivers/r600/r600_query.c
+++ b/src/gallium/drivers/r600/r600_query.c
@@ -264,6 +264,15 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned q
static void r600_destroy_query(struct pipe_context *ctx, struct pipe_query *query)
{
struct r600_query *rquery = (struct r600_query*)query;
+ struct r600_query_buffer *prev = rquery->buffer.previous;
+
+ /* Release all query buffers. */
+ while (prev) {
+ struct r600_query_buffer *qbuf = prev;
+ prev = prev->previous;
+ pipe_resource_reference((struct pipe_resource**)&qbuf->buf, NULL);
+ FREE(qbuf);
+ }
pipe_resource_reference((struct pipe_resource**)&rquery->buffer.buf, NULL);
FREE(query);