diff options
author | Uli Schlachter <psychon@znc.in> | 2013-12-31 15:18:01 +0100 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2014-03-21 14:39:44 +0100 |
commit | 2fb14e5883f2ea2f01d248674cfcc26ccb704753 (patch) | |
tree | 853269c6c96fefe3648cdc2e9feee9e83c01ac61 /src/xcb_conn.c | |
parent | 4dcbfd77b78ca6b016ce815af26235501f6cd75a (diff) |
Make xcb_disconnect(NULL) safe
Code can be simplified if the deallocation functions can always be called in
cleanup code. So if you have some code that does several things that can go
wrong, one of which is xcb_connect(), after this change, the xcb_connection_t*
variable can be initialized to NULL and xcb_disconnect() can always be called on
the connection object.
References: http://lists.freedesktop.org/archives/xcb/2013-September/008659.html
Signed-off-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Diffstat (limited to 'src/xcb_conn.c')
-rw-r--r-- | src/xcb_conn.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/xcb_conn.c b/src/xcb_conn.c index ab901a9..fa50985 100644 --- a/src/xcb_conn.c +++ b/src/xcb_conn.c @@ -350,7 +350,7 @@ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info) void xcb_disconnect(xcb_connection_t *c) { - if(is_static_error_conn(c)) + if(c == NULL || is_static_error_conn(c)) return; free(c->setup); |