radeon: Fix memory leak in radeonCreateScreen2.
authorVinson Lee <vlee@freedesktop.org>
Fri, 30 Nov 2012 07:10:03 +0000 (23:10 -0800)
committerVinson Lee <vlee@freedesktop.org>
Sat, 1 Dec 2012 03:34:31 +0000 (19:34 -0800)
Fixes a memory leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/drivers/dri/radeon/radeon_screen.c

index 6f4750a02fff048b24e3cda709817591182efb40..2e6cf3cb5c08e8a7dc0e6aa9f3031088f73c3de3 100644 (file)
@@ -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;