From: RĂ©mi Denis-Courmont Date: Thu, 7 Jan 2010 16:08:35 +0000 (+0200) Subject: xcb_connect_to_fd: fix descriptor leak on memory error path X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be7e528eae62ddee14fa50f2c0e9036bafbc9f81;hp=c7a57043da1717c18703a38772555fea6aa811bf;p=free-sw%2Fxcb%2Flibxcb xcb_connect_to_fd: fix descriptor leak on memory error path Signed-off-by: Julien Danjou --- 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;