r600g: Fixed a bo leak in the error path of radeon_ctx_set_bo_new().
authorTilman Sauerbeck <tilman@code-monkey.de>
Thu, 9 Sep 2010 12:57:32 +0000 (14:57 +0200)
committerTilman Sauerbeck <tilman@code-monkey.de>
Fri, 10 Sep 2010 11:09:33 +0000 (13:09 +0200)
Signed-off-by: Tilman Sauerbeck <tilman@code-monkey.de>
src/gallium/winsys/r600/drm/radeon_ctx.c

index bd0916aeb0b47eb65e1184774496ba32913a7f8c..a3ce7df75621a6626ef1a9a26bb46f9cd57c13cd 100644 (file)
@@ -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;