diff options
author | Rami Ylimaki <ext-rami.ylimaki@nokia.com> | 2009-11-17 17:13:43 +0200 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-11-25 15:26:30 +1000 |
commit | 18dcc102ac12a4b18c60b5dbabbc4d5debfe5556 (patch) | |
tree | 9e8b5517532e6cee04dc2260d2488da6978af028 | |
parent | b8904935bbd26e9d34587f03810318d94cb771f6 (diff) |
Xext: Fix a memory leak on GE client disconnect.
Add a call to dixRequestPrivate to inform dixFreePrivates that memory
allocated in GEClientCallback should be released when client
disconnects. Otherwise there is a leak of sizeof(GEClientInfoRec) for
every client connect/disconnect.
Also remove the explicit allocation and let GEGetClient /
dixLookupPrivate do it. This makes GEClientCallback similar to the
other extension callbacks.
Signed-off-by: Rami Ylimaki <ext-rami.ylimaki@nokia.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit eb967ca36cfe0409972ac987a74d498cd6f6bafb)
-rw-r--r-- | Xext/geext.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Xext/geext.c b/Xext/geext.c index 6fad4aec0..2ba0ca824 100644 --- a/Xext/geext.c +++ b/Xext/geext.c @@ -168,12 +168,6 @@ GEClientCallback(CallbackListPtr *list, ClientPtr pClient = clientinfo->client; GEClientInfoPtr pGEClient = GEGetClient(pClient); - if (pGEClient == NULL) - { - pGEClient = xcalloc(1, sizeof(GEClientInfoRec)); - dixSetPrivate(&pClient->devPrivates, GEClientPrivateKey, pGEClient); - } - pGEClient->major_version = 0; pGEClient->minor_version = 0; } @@ -222,6 +216,9 @@ GEExtensionInit(void) { ExtensionEntry *extEntry; + if (!dixRequestPrivate(GEClientPrivateKey, sizeof(GEClientInfoRec))) + FatalError("GEExtensionInit: GE private request failed.\n"); + if(!AddCallback(&ClientStateCallback, GEClientCallback, 0)) { FatalError("GEExtensionInit: register client callback failed.\n"); |