[PATCH xinput 2/5] Always call XCloseDisplay()

Peter Hutterer peter.hutterer at who-t.net
Sun Feb 19 19:36:58 PST 2012


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/xinput.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/xinput.c b/src/xinput.c
index a336f53..a1bb221 100644
--- a/src/xinput.c
+++ b/src/xinput.c
@@ -368,17 +368,17 @@ main(int argc, char * argv[])
 
     if (display == NULL) {
 	fprintf(stderr, "Unable to connect to X server\n");
-	return EXIT_FAILURE;
+	goto out;
     }
 
     if (!XQueryExtension(display, "XInputExtension", &xi_opcode, &event, &error)) {
         printf("X Input extension not available.\n");
-        return EXIT_FAILURE;
+        goto out;
     }
 
     if (!xinput_version(display)) {
 	fprintf(stderr, "%s extension not available\n", INAME);
-	return EXIT_FAILURE;
+	goto out;
     }
 
     while(driver->func_name) {
@@ -394,6 +394,9 @@ main(int argc, char * argv[])
 
     usage();
 
+out:
+    if (display)
+        XCloseDisplay(display);
     return EXIT_FAILURE;
 }
 
-- 
1.7.7.5



More information about the xorg-devel mailing list