[Mesa-dev] [PATCH 3/8] radeonsi: check that we don't leak fine.buf references

Nicolai Hähnle nhaehnle at gmail.com
Tue Nov 21 15:03:23 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Just as an added precaution.
---
 src/gallium/drivers/radeonsi/si_fence.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_fence.c b/src/gallium/drivers/radeonsi/si_fence.c
index 9d6bcfe1027..1bf99dd0239 100644
--- a/src/gallium/drivers/radeonsi/si_fence.c
+++ b/src/gallium/drivers/radeonsi/si_fence.c
@@ -438,26 +438,28 @@ static void si_flush_from_st(struct pipe_context *ctx,
 		/* If both fences are NULL, fence_finish will always return true. */
 		multi_fence->gfx = gfx_fence;
 		multi_fence->sdma = sdma_fence;
 
 		if (deferred_fence) {
 			multi_fence->gfx_unflushed.ctx = rctx;
 			multi_fence->gfx_unflushed.ib_index = rctx->num_gfx_cs_flushes;
 		}
 
 		multi_fence->fine = fine;
+		fine.buf = NULL;
 
 		if (flags & TC_FLUSH_ASYNC) {
 			util_queue_fence_signal(&multi_fence->ready);
 			tc_unflushed_batch_token_reference(&multi_fence->tc_token, NULL);
 		}
 	}
+	assert(!fine.buf);
 finish:
 	if (!(flags & PIPE_FLUSH_DEFERRED)) {
 		if (rctx->dma.cs)
 			ws->cs_sync_flush(rctx->dma.cs);
 		ws->cs_sync_flush(rctx->gfx.cs);
 	}
 }
 
 void si_init_fence_functions(struct si_context *ctx)
 {
-- 
2.11.0



More information about the mesa-dev mailing list