Skip to content

Commit 0ab7a73

Browse files
committed
libvncserver: ensure refCount==0 when disconnecting other clients
The idea is taken from rfbShutdownServer().
1 parent 4571951 commit 0ab7a73

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

libvncserver/rfbserver.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,12 +870,15 @@ rfbProcessClientInitMessage(rfbClientPtr cl)
870870
rfbReleaseClientIterator(iterator);
871871
} else {
872872
iterator = rfbGetClientIterator(cl->screen);
873-
while ((otherCl = rfbClientIteratorNext(iterator)) != NULL) {
873+
rfbClientPtr nextCl, otherCl = rfbClientIteratorNext(iterator);
874+
while (otherCl) {
875+
nextCl = rfbClientIteratorNext(iterator);
874876
if ((otherCl != cl) && (otherCl->state == RFB_NORMAL)) {
875877
rfbLog("Not shared - closing connection to client %s\n",
876878
otherCl->host);
877879
rfbCloseClient(otherCl);
878880
}
881+
otherCl = nextCl;
879882
}
880883
rfbReleaseClientIterator(iterator);
881884
}

0 commit comments

Comments
 (0)