From: ben Date: Sat, 11 Jan 2003 17:36:24 +0000 (+0000) Subject: Calling plug_closing() is highly likely to result in a call to sk_close(), X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/5320c49258059b6a929ae844d7487a353d189c53?ds=sidebyside Calling plug_closing() is highly likely to result in a call to sk_close(), so arrange that mactcp_poll() can cope with that and not access freed memory when it happens. git-svn-id: svn://svn.tartarus.org/sgt/putty@2545 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/mac/mtcpnet.c b/mac/mtcpnet.c index bd630878..54ca10ca 100644 --- a/mac/mtcpnet.c +++ b/mac/mtcpnet.c @@ -603,11 +603,11 @@ static pascal void mactcp_asr(StreamPtr str, unsigned short event, Ptr cookie, */ void mactcp_poll(void) { - Actual_Socket s; + Actual_Socket s, next; TCPiopb pb; - for (s = mactcp.socklist; s != NULL; s = s->next) { - /* XXX above can't handle sockets being deleted. */ + for (s = mactcp.socklist; s != NULL; s = next) { + next = s->next; do { pb.ioCRefNum = mactcp.refnum; pb.csCode = TCPStatus;