summaryrefslogtreecommitdiff
path: root/composite
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-01-27 11:20:45 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-02-05 18:30:13 -0800
commit48b94651205b175760904e448f94111d1ab85e13 (patch)
tree1a4fad927546eb406be1a3144eec409779df1f12 /composite
parentf4a9332ad149ed15353a9c482563bdd042d0b403 (diff)
Stop leaking overlayWin in PanoramiXCompositeGetOverlayWindow error paths
Found by parfait 1.1 code analyzer: Error: Memory leak (CWE 401) Memory leak of pointer 'overlayWin' allocated with malloc(72) at line 806 of composite/compext.c in function 'PanoramiXCompositeGetOverlayWindow'. pointer allocated at line 794 with malloc(72). <unknown> leaks when rc != 0 at line 804. at line 816 of composite/compext.c in function 'PanoramiXCompositeGetOverlayWindow'. pointer allocated at line 794 with malloc(72). <unknown> leaks when pOc == NULL at line 815. at line 825 of composite/compext.c in function 'PanoramiXCompositeGetOverlayWindow'. pointer allocated at line 794 with malloc(72). <unknown> leaks when cs->pOverlayWin == NULL at line 822 and compCreateOverlayWindow(pScreen) == 0 at line 823. at line 834 of composite/compext.c in function 'PanoramiXCompositeGetOverlayWindow'. pointer allocated at line 794 with malloc(72). <unknown> leaks when rc != 0 at line 832. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'composite')
-rw-r--r--composite/compext.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/composite/compext.c b/composite/compext.c
index 8641eff5e..e4821c5fc 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -803,6 +803,7 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
RT_WINDOW, client, DixGetAttrAccess);
if (rc != Success) {
client->errorValue = stuff->window;
+ free(overlayWin);
return rc;
}
pScreen = pWin->drawable.pScreen;
@@ -812,8 +813,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
@@ -822,6 +825,7 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
if (cs->pOverlayWin == NULL)
if (!compCreateOverlayWindow(pScreen)) {
FreeResource(pOc->resource, RT_NONE);
+ free(overlayWin);
return BadAlloc;
}
@@ -831,6 +835,7 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
DixGetAttrAccess);
if (rc != Success) {
FreeResource(pOc->resource, RT_NONE);
+ free(overlayWin);
return rc;
}
}