[PATCH libXext] Destroy generic event extension after last display is removed

Chase Douglas chase.douglas at canonical.com
Fri Apr 20 15:08:08 PDT 2012


The extension record is currently leaked and never freed.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 src/Xge.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/Xge.c b/src/Xge.c
index 74e4802..1f37e59 100644
--- a/src/Xge.c
+++ b/src/Xge.c
@@ -218,7 +218,15 @@ _xgeDpyClose(Display* dpy, XExtCodes* codes)
         XFree(xge_data);
     }
 
-    return XextRemoveDisplay(xge_info, dpy);
+    if(!XextRemoveDisplay(xge_info, dpy))
+        return 0;
+
+    if (xge_info->ndisplays == 0) {
+        XextDestroyExtension(xge_info);
+        xge_info = NULL;
+    }
+
+    return 1;
 }
 
 /*
-- 
1.7.9.1



More information about the xorg-devel mailing list