Mesa (master): r600g: Fixed a bo leak in the error path of radeon_ctx_set_bo_new().

Tilman Sauerbeck tilman at kemper.freedesktop.org
Fri Sep 10 11:20:46 UTC 2010


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

Author: Tilman Sauerbeck <tilman at code-monkey.de>
Date:   Thu Sep  9 14:57:32 2010 +0200

r600g: Fixed a bo leak in the error path of radeon_ctx_set_bo_new().

Signed-off-by: Tilman Sauerbeck <tilman at code-monkey.de>

---

 src/gallium/winsys/r600/drm/radeon_ctx.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/gallium/winsys/r600/drm/radeon_ctx.c b/src/gallium/winsys/r600/drm/radeon_ctx.c
index bd0916a..a3ce7df 100644
--- a/src/gallium/winsys/r600/drm/radeon_ctx.c
+++ b/src/gallium/winsys/r600/drm/radeon_ctx.c
@@ -34,7 +34,7 @@ static int radeon_ctx_set_bo_new(struct radeon_ctx *ctx, struct radeon_bo *bo)
 {
 	if (ctx->nbo >= RADEON_CTX_MAX_PM4)
 		return -EBUSY;
-	ctx->bo[ctx->nbo] = bo;
+	ctx->bo[ctx->nbo] = radeon_bo_incref(ctx->radeon, bo);
 	ctx->nbo++;
 	return 0;
 }
@@ -137,7 +137,6 @@ static int radeon_ctx_state_bo(struct radeon_ctx *ctx, struct radeon_state *stat
 				break;
 		}
 		if (j == ctx->nbo) {
-			radeon_bo_incref(ctx->radeon, state->bo[i]);
 			r = radeon_ctx_set_bo_new(ctx, state->bo[i]);
 			if (r)
 				return r;




More information about the mesa-commit mailing list