[Xcb] [PATCH] xcb_connect_to_fd: fix descriptor leak on memory error path
Rémi Denis-Courmont
remi at remlab.net
Thu Jan 7 08:08:35 PST 2010
---
src/xcb_conn.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/xcb_conn.c b/src/xcb_conn.c
index ff98fb7..23b2eb1 100644
--- a/src/xcb_conn.c
+++ b/src/xcb_conn.c
@@ -223,8 +223,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;
--
1.6.6
More information about the Xcb
mailing list