Skip to content

Commit 0d76f9d

Browse files
committed
bug: fix the memory leaks of localAddr and localAddr in conn
Fixes #546
1 parent 6d01da7 commit 0d76f9d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

connection_unix.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ func newUDPConn(fd int, el *eventloop, localAddr net.Addr, sa unix.Sockaddr, con
8585

8686
func (c *conn) release() {
8787
c.ctx = nil
88-
c.localAddr = nil
89-
c.remoteAddr = nil
9088
c.buffer = nil
9189
if addr, ok := c.localAddr.(*net.TCPAddr); ok && c.localAddr != c.loop.ln.addr && len(addr.Zone) > 0 {
9290
bsPool.Put(bs.StringToBytes(addr.Zone))
9391
}
9492
if addr, ok := c.remoteAddr.(*net.TCPAddr); ok && len(addr.Zone) > 0 {
9593
bsPool.Put(bs.StringToBytes(addr.Zone))
9694
}
95+
c.localAddr = nil
96+
c.remoteAddr = nil
9797
c.pollAttachment.FD, c.pollAttachment.Callback = 0, nil
9898
if !c.isDatagram {
9999
c.opened = false

0 commit comments

Comments
 (0)