[PATCH 11/12] composite/xinerama: free overlayWin on error paths.

Dave Airlie airlied at gmail.com
Thu Oct 20 03:44:27 PDT 2011


From: Dave Airlie <airlied at redhat.com>

pointed out by coverity scan.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 composite/compext.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/composite/compext.c b/composite/compext.c
index 01bd578..16daf23 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -777,6 +777,7 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
 	if (rc != Success)
 	{
 	    client->errorValue = stuff->window;
+	    free(overlayWin);
 	    return rc;
 	}
 	pScreen = pWin->drawable.pScreen;
@@ -786,8 +787,10 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
 	 * interest in the overlay window
 	 */
 	pOc = compCreateOverlayClient(pScreen, client);
-	if (pOc == NULL)
+	if (pOc == NULL) {
+	    free(overlayWin);
 	    return BadAlloc;
+	}
 
 	/*
 	 * Make sure the overlay window exists
@@ -797,6 +800,7 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
 	    if (!compCreateOverlayWindow(pScreen))
 	    {
 		FreeResource (pOc->resource, RT_NONE);
+	        free(overlayWin);
 		return BadAlloc;
 	    }
 
@@ -807,6 +811,7 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
 	if (rc != Success)
 	{
 	    FreeResource (pOc->resource, RT_NONE);
+	    free(overlayWin);
 	    return rc;
 	}
     }
-- 
1.7.6.4



More information about the xorg-devel mailing list