[Mesa-dev] [PATCH 1/3] r600g: Fixed a bo leak in r600_blit_state_ps_shader().

Tilman Sauerbeck tilman at code-monkey.de
Fri Sep 10 09:32:46 PDT 2010


We would leak the newly created bo if it cannot be mapped.

Signed-off-by: Tilman Sauerbeck <tilman at code-monkey.de>
---
 src/gallium/drivers/r600/r600_blit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index e6ded34..e6b3be6 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -335,10 +335,10 @@ static void r600_blit_state_ps_shader(struct r600_screen *rscreen, struct radeon
 	/* simple shader */
 	bo = radeon_bo(rscreen->rw, 0, 128, 4096, NULL);
 	if (bo == NULL) {
-		radeon_bo_decref(rscreen->rw, bo);
 		return;
 	}
 	if (radeon_bo_map(rscreen->rw, bo)) {
+		radeon_bo_decref(rscreen->rw, bo);
 		return;
 	}
 	switch (rscreen->chip_class) {
-- 
1.7.2.3



More information about the mesa-dev mailing list