Summary: | XCB leaks memory and socket file descriptor on connection failure. | ||
---|---|---|---|
Product: | XCB | Reporter: | jp.sittingduck |
Component: | Library | Assignee: | Josh Triplett <josh> |
Status: | RESOLVED FIXED | QA Contact: | xcb mailing list dummy <xcb> |
Severity: | normal | ||
Priority: | medium | CC: | josh |
Version: | unspecified | Keywords: | patch |
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
A test-case to show leak.
Here is my proposed patch. Patch to allow disconnecting connections in the error state |
Created attachment 38900 [details] [review] Here is my proposed patch. This is my proposed patch that adds an is_open field to xcb_connection_t, which is checked in xcb_disconnect so that an open connection can be cleaned up despite having had an error. error_connection in xcb_conn.c is changed from an int to an xcb_connection_t, with has_error and is_open set to 1 and 0 respectively. In an amusing coincidence, Josh has a different patch sitting in his queue that we wrote last week for this same issue. Josh? Created attachment 38920 [details] [review] Patch to allow disconnecting connections in the error state Jamey and I wrote the attached patch on the plane back from XDS 2010: Subject: [PATCH] Allow disconnecting connections that are in error state. In support of this, consolidate the two static error_connection definitions into one so we don't try to free the static out-of-memory error_connection. Commit by Josh Triplett and Jamey Sharp. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Jamey Sharp <jamey@minilop.net> I confirmed that the test case no longer leaks the connection when used with this patch, so I've pushed the patch to libxcb master. Closing this bug. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.
Created attachment 38899 [details] A test-case to show leak. When there is a connection error, XCB sets has_error to 1 in xcb_connection_t, which precludes clean-up (since, if has_error is set to 1, the connection may be a pointer to the error_connection variable). Attached is a test-case that simulates a connection failure. Running it in valgrind will show not only a memory leak, but a file descriptor leak (the socket) too.