Fix XCB memory leaks and correctly use XCB/Xlib interop.