summary refs log tree commit diff stats
path: root/nimsuggest/nimsuggest.nim
diff options
context:
space:
mode:
authoralaviss <alaviss@users.noreply.github.com>2019-10-08 06:11:18 +0000
committerAndreas Rumpf <rumpf_a@web.de>2019-10-08 08:11:18 +0200
commite9fa4c9b9c8e2926449399a69a02676936bb842c (patch)
tree6f23d61cae4d80d2b05562db9bf89322a757fc48 /nimsuggest/nimsuggest.nim
parent0355c64b92ad388c1dade93415630df16256500b (diff)
downloadNim-e9fa4c9b9c8e2926449399a69a02676936bb842c.tar.gz
nimsuggest: fix tcp socket leak (#12377) [backport]
A new socket is created for each iteration and leak immediately thanks
to the accept() call replacing the created socket with the client socket.

This commit fixes that.
Diffstat (limited to 'nimsuggest/nimsuggest.nim')
-rw-r--r--nimsuggest/nimsuggest.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/nimsuggest/nimsuggest.nim b/nimsuggest/nimsuggest.nim
index af87c9e7f..b61dfe797 100644
--- a/nimsuggest/nimsuggest.nim
+++ b/nimsuggest/nimsuggest.nim
@@ -319,8 +319,8 @@ proc replTcp(x: ThreadParams) {.thread.} =
     server.bindAddr(x.port, x.address)
     server.listen()
   var inp = "".TaintedString
+  var stdoutSocket: Socket
   while true:
-    var stdoutSocket = newSocket()
     accept(server, stdoutSocket)
 
     stdoutSocket.readLine(inp)