From: Josh Triplett <[email protected]>

Make _XConnectXCB translate error connections to NULL.

Also, call xcb_disconnect on the error path.

Commit by Josh Triplett and Jamey Sharp.

Signed-off-by: Josh Triplett <[email protected]>
Signed-off-by: Jamey Sharp <[email protected]>
Signed-off-by: Mike Blumenkrantz <[email protected]>
---
 src/OpenDis.c  | 3 +--
 src/xcb_disp.c | 4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/OpenDis.c b/src/OpenDis.c
index 8f6d1ef..509060e 100644
--- a/src/OpenDis.c
+++ b/src/OpenDis.c
@@ -115,8 +115,7 @@ XOpenDisplay (
  * If NULL is returned, the connection failed.
  */
 
-       c = _XConnectXCB(display, &iscreen);
-       if(!c || xcb_connection_has_error(c)) {
+       if(!(c = _XConnectXCB(display, &iscreen))) {
                return NULL;
        }
 
diff --git a/src/xcb_disp.c b/src/xcb_disp.c
index 74f87c0..9ff650e 100644
--- a/src/xcb_disp.c
+++ b/src/xcb_disp.c
@@ -72,5 +72,9 @@ xcb_connection_t *_XConnectXCB(_Xconst char *display,
int *screenp) c = xcb_connect(display, NULL);
        _XUnlockMutex(_Xglobal_lock);
 
+       if(xcb_connection_has_error(c)) {
+               xcb_disconnect(c);
+               return NULL;
+       }
        return c;
 }
-- 
2.4.2

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to