Bingo! Thanks for the quick reply.
I was using the example at
[https://nim-lang.org/docs/net.html](https://nim-lang.org/docs/net.html), so
maybe this is just a docs update ticket.
I can't simply declare the var type in advance without an assignment:
var client: Socket
server.acceptAddr( client, address )
...
Traceback (most recent call last)
test.nim(21) test
net.nim(867) close
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
However, I can create the socket and immediately close it.
var client = newSocket()
client.close
server.acceptAddr( client, address )
... which works, without leaking, though definitely isn't an obvious path.
Fixed.
What is the "right" way do do this?