From: Benoit Gschwind Date: Sat, 24 Aug 2019 21:18:53 +0000 (+0200) Subject: fix to early remove of iterator in VNCServerST::removeSocket X-Git-Tag: v1.9.90~2^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8e09912f9d66e5bef8146040b366286c661e3b53;p=tigervnc.git fix to early remove of iterator in VNCServerST::removeSocket --- diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index a3655bca..a764f1bc 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -165,8 +165,6 @@ void VNCServerST::removeSocket(network::Socket* sock) { std::list::iterator ci; for (ci = clients.begin(); ci != clients.end(); ci++) { if ((*ci)->getSock() == sock) { - clients.remove(*ci); - // - Remove any references to it if (pointerClient == *ci) pointerClient = NULL; @@ -182,6 +180,8 @@ void VNCServerST::removeSocket(network::Socket* sock) { // - Delete the per-Socket resources delete *ci; + clients.remove(*ci); + CharArray name; name.buf = sock->getPeerEndpoint(); connectionsLog.status("closed: %s", name.buf);