xcb: Ensure the XCB connection is valid before using it.

This commit is contained in:
Colin Guthrie 2010-09-18 10:35:38 +01:00
parent eef247b57e
commit 2c564f2e9e
2 changed files with 10 additions and 0 deletions

View file

@ -55,6 +55,11 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
goto finish; 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))) { if (pa_x11_get_prop(xcb, "PULSE_SERVER", t, sizeof(t))) {
pa_bool_t disable_autospawn = TRUE; pa_bool_t disable_autospawn = TRUE;

View file

@ -100,6 +100,11 @@ int main(int argc, char *argv[]) {
goto finish; goto finish;
} }
if (xcb_connection_has_error(xcb)) {
pa_log(_("xcb_connection_has_error() returned true"));
goto finish;
}
switch (mode) { switch (mode) {
case DUMP: { case DUMP: {
char t[1024]; char t[1024];