[PATCHv3 10/14] fb: fix memory leak in fbOverlayFinishScreenInit

Tiago Vignatti tiago.vignatti at nokia.com
Tue Mar 29 08:08:16 PDT 2011


Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
---
 fb/fboverlay.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/fb/fboverlay.c b/fb/fboverlay.c
index 7fca89c..45e6370 100644
--- a/fb/fboverlay.c
+++ b/fb/fboverlay.c
@@ -390,12 +390,16 @@ fbOverlayFinishScreenInit(ScreenPtr	pScreen,
    
     if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &depth1,
 			&defaultVisual, ((unsigned long)1<<(bpp1-1)) |
-			((unsigned long)1<<(bpp2-1)), 8))
+			((unsigned long)1<<(bpp2-1)), 8)) {
+	free(pScrPriv);
 	return FALSE;
+    }
     if (! miScreenInit(pScreen, 0, xsize, ysize, dpix, dpiy, 0,
 			depth1, ndepths, depths,
-			defaultVisual, nvisuals, visuals))
+			defaultVisual, nvisuals, visuals)) {
+	free(pScrPriv);
 	return FALSE;
+    }
     /* MI thinks there's no frame buffer */
 #ifdef MITSHM
     ShmRegisterFbFuncs(pScreen);
-- 
1.7.0.4



More information about the xorg-devel mailing list