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

uxnet: clean up callbacks when closing a NetSocket.

uxnet.c's method for passing socket errors on to the Plug involves
setting up a toplevel callback using the NetSocket itself as the
context. Therefore, it should call delete_callbacks_for_context when
it destroys a NetSocket. For example, if _two_ socket errors manage to
occur, and the first one causes the socket to be closed, you need the
second callback to not happen, or it'll dereference the freed pointer.
This commit is contained in:
Simon Tatham 2019-01-29 20:15:43 +00:00
parent af3ccd7946
commit 8329d192be

View File

@ -1022,6 +1022,7 @@ static void sk_net_close(Socket *sock)
} }
if (s->addr) if (s->addr)
sk_addr_free(s->addr); sk_addr_free(s->addr);
delete_callbacks_for_context(s);
sfree(s); sfree(s);
} }