[PATCH 05/10] xi: fix memory leak in AddExtensionClient

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


Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
 Xi/exevents.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index c7089bb..6923f6a 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1631,14 +1631,18 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
     if (!others)
 	return BadAlloc;
     if (!pWin->optional->inputMasks && !MakeInputMasks(pWin))
-	return BadAlloc;
+	goto bail;
     others->mask[mskidx] = mask;
     others->resource = FakeClientID(client->index);
     others->next = pWin->optional->inputMasks->inputClients;
     pWin->optional->inputMasks->inputClients = others;
     if (!AddResource(others->resource, RT_INPUTCLIENT, (pointer) pWin))
-	return BadAlloc;
+	goto bail;
     return Success;
+
+bail:
+    free(others);
+    return BadAlloc;
 }
 
 static Bool
-- 
1.7.0.4



More information about the xorg-devel mailing list