1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

uxnet.c: don't close a socket's fd if it is -1.

This is harmless in principle (you just get EBADF back from close(2)
and ignore it), but it leads to warnings in valgrind.
This commit is contained in:
Simon Tatham 2017-10-01 21:05:25 +01:00
parent 16214ea0f5
commit f813e9f937

View File

@ -1023,9 +1023,11 @@ static void sk_tcp_close(Socket sock)
if (s->child)
sk_tcp_close((Socket)s->child);
uxsel_del(s->s);
del234(sktree, s);
close(s->s);
if (s->s >= 0) {
uxsel_del(s->s);
close(s->s);
}
if (s->addr)
sk_addr_free(s->addr);
sfree(s);