[Mesa-dev] [PATCH] radeon: Fix memory leak in radeonCreateScreen2.

Vinson Lee vlee at freedesktop.org
Thu Nov 29 23:25:18 PST 2012


Fixes a memory leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 src/mesa/drivers/dri/radeon/radeon_screen.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 6f4750a..2e6cf3c 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -510,8 +510,10 @@ radeonCreateScreen2(__DRIscreen *sPriv)
    }
 
    ret = radeon_set_screen_flags(screen, device_id);
-   if (ret == -1)
+   if (ret == -1) {
+     free(screen);
      return NULL;
+   }
 
    if (getenv("RADEON_NO_TCL"))
 	   screen->chip_flags &= ~RADEON_CHIPSET_TCL;
-- 
1.8.0



More information about the mesa-dev mailing list