Calling plug_closing() is highly likely to result in a call to sk_close(),
authorben <ben@cda61777-01e9-0310-a592-d414129be87e>
Sat, 11 Jan 2003 17:36:24 +0000 (17:36 +0000)
committerben <ben@cda61777-01e9-0310-a592-d414129be87e>
Sat, 11 Jan 2003 17:36:24 +0000 (17:36 +0000)
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

mac/mtcpnet.c

index bd63087..54ca10c 100644 (file)
@@ -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;