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-Tag: 1.6~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be7e528eae62ddee14fa50f2c0e9036bafbc9f81;p=platform%2Fupstream%2Flibxcb.git 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;