summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-09-29 15:42:33 +0200
committerPierre Ossman <ossman@cendio.se>2015-09-29 15:42:33 +0200
commiteab85bca5e209924f1474802ab9e70b8c8771f2a (patch)
treea7b1a61003eb708f5ff0b7c5ac21a6912aa0f923 /win
parentf7aa3f9bd315ba52d6ee1e7236a580102c8d20b8 (diff)
downloadtigervnc-eab85bca5e209924f1474802ab9e70b8c8771f2a.tar.gz
tigervnc-eab85bca5e209924f1474802ab9e70b8c8771f2a.zip
Clean up listening sockets on error
Diffstat (limited to 'win')
-rw-r--r--win/winvnc/ManagedListener.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/win/winvnc/ManagedListener.cxx b/win/winvnc/ManagedListener.cxx
index b80f5a16..9137238a 100644
--- a/win/winvnc/ManagedListener.cxx
+++ b/win/winvnc/ManagedListener.cxx
@@ -107,7 +107,11 @@ void ManagedListener::refresh() {
for (iter = sockets.begin(); iter != sockets.end(); ++iter)
manager->addListener(*iter, server, addrChangeNotifier);
} catch (...) {
- // FIXME: Should unwind what we've added
+ std::list<network::TcpListener*>::iterator iter2;
+ for (iter2 = sockets.begin(); iter2 != iter; ++iter2)
+ manager->remListener(*iter2);
+ for (; iter2 != sockets.end(); ++iter2)
+ delete *iter;
sockets.clear();
throw;
}