Skip to content

Commit

Permalink
bug: fix the memory leaks of localAddr and localAddr in conn
Browse files Browse the repository at this point in the history
Fixes #546
  • Loading branch information
panjf2000 committed Mar 18, 2024
1 parent 6d01da7 commit 2f89586
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions connection_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ func newUDPConn(fd int, el *eventloop, localAddr net.Addr, sa unix.Sockaddr, con

func (c *conn) release() {
c.ctx = nil
c.localAddr = nil
c.remoteAddr = nil
c.buffer = nil
if addr, ok := c.localAddr.(*net.TCPAddr); ok && c.localAddr != c.loop.ln.addr && len(addr.Zone) > 0 {
bsPool.Put(bs.StringToBytes(addr.Zone))
}
if addr, ok := c.remoteAddr.(*net.TCPAddr); ok && len(addr.Zone) > 0 {
bsPool.Put(bs.StringToBytes(addr.Zone))
}
c.localAddr = nil
c.remoteAddr = nil
c.pollAttachment.FD, c.pollAttachment.Callback = 0, nil
if !c.isDatagram {
c.opened = false
Expand Down

0 comments on commit 2f89586

Please sign in to comment.