aboutsummaryrefslogtreecommitdiff
path: root/backend/x11
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-06-30 12:57:48 +0100
committerGitHub <noreply@github.com>2018-06-30 12:57:48 +0100
commit167105e6069d2dd66cd2d472c2a6b67703838125 (patch)
treee6626f03fdd94c7832c4b5cb3b97e2a61cf6602e /backend/x11
parent63eb720871004219826f16e0a79a0014ac5516e4 (diff)
parent0c2a64df18f8740ab795fb2970d1954a8aac34b1 (diff)
Merge pull request #1101 from martinetd/static-analysis
Static analysis fixes
Diffstat (limited to 'backend/x11')
-rw-r--r--backend/x11/backend.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index d4793b9c..e35cbed7 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -245,13 +245,13 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
x11->xlib_conn = XOpenDisplay(x11_display);
if (!x11->xlib_conn) {
wlr_log(L_ERROR, "Failed to open X connection");
- return NULL;
+ goto error_x11;
}
x11->xcb_conn = XGetXCBConnection(x11->xlib_conn);
if (!x11->xcb_conn || xcb_connection_has_error(x11->xcb_conn)) {
wlr_log(L_ERROR, "Failed to open xcb connection");
- goto error_x11;
+ goto error_display;
}
XSetEventQueueOwner(x11->xlib_conn, XCBOwnsEventQueue);
@@ -262,7 +262,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
x11->event_source = wl_event_loop_add_fd(ev, fd, events, x11_event, x11);
if (!x11->event_source) {
wlr_log(L_ERROR, "Could not create event source");
- goto error_x11;
+ goto error_display;
}
x11->screen = xcb_setup_roots_iterator(xcb_get_setup(x11->xcb_conn)).data;
@@ -291,8 +291,9 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
error_event:
wl_event_source_remove(x11->event_source);
-error_x11:
+error_display:
XCloseDisplay(x11->xlib_conn);
+error_x11:
free(x11);
return NULL;
}