[Mesa-dev] [PATCH 02/21] r600g: release query buffers in destroy_query
Marek Olšák
maraeo at gmail.com
Wed Feb 29 08:52:55 PST 2012
This fixes a memory leak introduced with the rework.
---
src/gallium/drivers/r600/r600_query.c | 9 +++++++++
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 a896f03..25731c2 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);
--
1.7.5.4
More information about the mesa-dev
mailing list