Skip to content

Commit

Permalink
fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Mar 13, 2017
1 parent 2f21a5b commit 1de9285
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sess.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ func (s *UDPSession) Write(b []byte) (n int, err error) {
// Close closes the connection.
func (s *UDPSession) Close() error {
updater.removeSession(s)
s.l.closeSession(s.remote)
if s.l != nil { // notify listener
s.l.closeSession(s.remote)
}

s.mu.Lock()
defer s.mu.Unlock()
Expand Down

0 comments on commit 1de9285

Please sign in to comment.