Do not close(-1) when freeing an uninitialized socket bufferevent

This commit is contained in:
Nick Mathewson 2010-03-12 18:36:18 -05:00
parent 70a44b61bb
commit b34abf3069

View File

@ -559,7 +559,7 @@ be_socket_destruct(struct bufferevent *bufev)
event_del(&bufev->ev_read);
event_del(&bufev->ev_write);
if (bufev_p->options & BEV_OPT_CLOSE_ON_FREE)
if ((bufev_p->options & BEV_OPT_CLOSE_ON_FREE) && fd >= 0)
EVUTIL_CLOSESOCKET(fd);
}