xcb: Ensure the XCB connection is valid before using it.
authorColin Guthrie <cguthrie@mandriva.org>
Sat, 18 Sep 2010 09:35:38 +0000 (10:35 +0100)
committerColin Guthrie <cguthrie@mandriva.org>
Sat, 18 Sep 2010 11:05:19 +0000 (12:05 +0100)
src/pulse/client-conf-x11.c
src/utils/pax11publish.c

index 565f997..0348a2f 100644 (file)
@@ -55,6 +55,11 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
         goto finish;
     }
 
+    if (xcb_connection_has_error(xcb)) {
+        pa_log(_("xcb_connection_has_error() returned true"));
+        goto finish;
+    }
+
     if (pa_x11_get_prop(xcb, "PULSE_SERVER", t, sizeof(t))) {
         pa_bool_t disable_autospawn = TRUE;
 
index 111bee2..62b798c 100644 (file)
@@ -100,6 +100,11 @@ int main(int argc, char *argv[]) {
         goto finish;
     }
 
+    if (xcb_connection_has_error(xcb)) {
+        pa_log(_("xcb_connection_has_error() returned true"));
+        goto finish;
+    }
+
     switch (mode) {
         case DUMP: {
             char t[1024];