From be7e528eae62ddee14fa50f2c0e9036bafbc9f81 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Thu, 7 Jan 2010 18:08:35 +0200 Subject: [PATCH] xcb_connect_to_fd: fix descriptor leak on memory error path Signed-off-by: Julien Danjou --- src/xcb_conn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.34.1