Mesa (master): gallium/radeon: add a proper fail path for calloc in r600_flush_from_st

Marek Olšák mareko at kemper.freedesktop.org
Mon Sep 11 14:30:18 UTC 2017


Module: Mesa
Branch: master
Commit: fc454954742e98213397a97033ab4f5b927e98d9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc454954742e98213397a97033ab4f5b927e98d9

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Sep  1 23:26:59 2017 +0200

gallium/radeon: add a proper fail path for calloc in r600_flush_from_st

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 src/gallium/drivers/radeon/r600_pipe_common.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index a5678faf89..b17bf80bf5 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -453,8 +453,11 @@ static void r600_flush_from_st(struct pipe_context *ctx,
 	if (fence) {
 		struct r600_multi_fence *multi_fence =
 			CALLOC_STRUCT(r600_multi_fence);
-		if (!multi_fence)
-			return;
+		if (!multi_fence) {
+			ws->fence_reference(&sdma_fence, NULL);
+			ws->fence_reference(&gfx_fence, NULL);
+			goto finish;
+		}
 
 		multi_fence->reference.count = 1;
 		/* If both fences are NULL, fence_finish will always return true. */
@@ -469,7 +472,7 @@ static void r600_flush_from_st(struct pipe_context *ctx,
 		screen->fence_reference(screen, fence, NULL);
 		*fence = (struct pipe_fence_handle*)multi_fence;
 	}
-
+finish:
 	if (!(flags & PIPE_FLUSH_DEFERRED)) {
 		if (rctx->dma.cs)
 			ws->cs_sync_flush(rctx->dma.cs);




More information about the mesa-commit mailing list