summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRĂ©mi Denis-Courmont <remi@remlab.net>2010-01-07 18:08:35 +0200
committerJulien Danjou <julien@danjou.info>2010-01-07 18:03:30 +0100
commitbe7e528eae62ddee14fa50f2c0e9036bafbc9f81 (patch)
tree2d5d8808b2c6099226520f9648f27ea1d5daa31c /src
parentc7a57043da1717c18703a38772555fea6aa811bf (diff)
xcb_connect_to_fd: fix descriptor leak on memory error path
Signed-off-by: Julien Danjou <julien@danjou.info>
Diffstat (limited to 'src')
-rw-r--r--src/xcb_conn.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/xcb_conn.c b/src/xcb_conn.c
index 251d62e..ed2153d 100644
--- a/src/xcb_conn.c
+++ b/src/xcb_conn.c
@@ -211,8 +211,10 @@ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
xcb_connection_t* c;
c = calloc(1, sizeof(xcb_connection_t));
- if(!c)
+ if(!c) {
+ close(fd);
return (xcb_connection_t *) &error_connection;
+ }
c->fd = fd;