diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-19 18:55:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-19 18:55:24 +0300 |
commit | 22fe614f7a528b209fc2075cf76274fbcb780814 (patch) | |
tree | 5b46e683eef05e4088c8596bba1eb5d4d1ee6c7f /src/net/ipc.cpp | |
parent | 5a5d0398820a482a88f878638e74ccad6f2d2c50 (diff) | |
download | manaverse-22fe614f7a528b209fc2075cf76274fbcb780814.tar.gz manaverse-22fe614f7a528b209fc2075cf76274fbcb780814.tar.bz2 manaverse-22fe614f7a528b209fc2075cf76274fbcb780814.tar.xz manaverse-22fe614f7a528b209fc2075cf76274fbcb780814.zip |
Fix memory leak with ipc port selection.
Diffstat (limited to 'src/net/ipc.cpp')
-rw-r--r-- | src/net/ipc.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/net/ipc.cpp b/src/net/ipc.cpp index 559c65a59..96113154f 100644 --- a/src/net/ipc.cpp +++ b/src/net/ipc.cpp @@ -22,9 +22,11 @@ #include "logger.h" -#include "gui/widgets/tabs/chattab.h" #include "gui/windows/chatwindow.h" +#include "gui/widgets/tabs/chattab.h" + +#include "utils/delete2.h" #include "utils/sdlhelper.h" #include "utils/stringutils.h" @@ -150,18 +152,20 @@ void IPC::start() port = atoi(getenv("IPC_PORT")); logger->log("Starting IPC..."); + ipc = new IPC; for (int port = 44007; port < 65535; port ++) { + ipc->setPort(port); logger->log(" -> trying port %d...", ipc_port); - ipc = new IPC(port); if (ipc->init()) { logger->log(" -> Port %d selected", ipc_port); - break; + return; } else { port ++; } } + delete2(ipc); } |