X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb_util.c;h=5a82ac129c6b2434306e6e0b790d5dcab50339e8;hb=de3cdad87a341c238c544425f4dd574b19c58ae3;hp=fe1f99ff01f2bb307539ad649f3a2abe9513d2d4;hpb=18718d483e0982c779a61c71176fb0e64f850015;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/xcb_util.c b/src/xcb_util.c index fe1f99f..5a82ac1 100644 --- a/src/xcb_util.c +++ b/src/xcb_util.c @@ -398,24 +398,28 @@ xcb_connection_t *xcb_connect(const char *displayname, int *screenp) xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname, xcb_auth_info_t *auth, int *screenp) { int fd, display = 0; - char *host; - char *protocol; + char *host = NULL; + char *protocol = NULL; xcb_auth_info_t ourauth; xcb_connection_t *c; int parsed = _xcb_parse_display(displayname, &host, &protocol, &display, screenp); - if(!parsed) - return (xcb_connection_t *) &error_connection; - else + if(!parsed) { + c = (xcb_connection_t *) &error_connection; + goto out; + } else fd = _xcb_open(host, protocol, display); - free(host); - if(fd == -1) - return (xcb_connection_t *) &error_connection; + if(fd == -1) { + c = (xcb_connection_t *) &error_connection; + goto out; + } - if(auth) - return xcb_connect_to_fd(fd, auth); + if(auth) { + c = xcb_connect_to_fd(fd, auth); + goto out; + } if(_xcb_get_auth_info(fd, &ourauth, display)) { @@ -426,5 +430,8 @@ xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname, else c = xcb_connect_to_fd(fd, 0); +out: + free(host); + free(protocol); return c; }