libmill icon indicating copy to clipboard operation
libmill copied to clipboard

socket leak on tcpconnect() timeout

Open majek opened this issue 7 years ago • 0 comments

If I read this code right: https://github.com/sustrik/libmill/blob/2dd13ae8a1e4c9b5b89670f813a185dd51c43a66/tcp.c#L209

    int rc = connect(s, (struct sockaddr*)&addr, mill_iplen(addr));
    if(rc != 0) {
        mill_assert(rc == -1);
        if(errno != EINPROGRESS)
            return NULL;
        rc = fdwait(s, FDW_OUT, deadline);
        if(rc == 0) {
            errno = ETIMEDOUT;
            return NULL;
        }

On fdwait() timeout, the "s" never gets "closed()".

majek avatar Feb 17 '18 13:02 majek