xcb_connect_to_fd: fix descriptor leak on memory error path

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Rémi Denis-Courmont 2010-01-07 18:08:35 +02:00 committed by Julien Danjou
parent c7a57043da
commit be7e528eae

View File

@ -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;