Skip to content

Commit 1de9285

Browse files
committed
fix memory leak
1 parent 2f21a5b commit 1de9285

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sess.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,9 @@ func (s *UDPSession) Write(b []byte) (n int, err error) {
291291
// Close closes the connection.
292292
func (s *UDPSession) Close() error {
293293
updater.removeSession(s)
294-
s.l.closeSession(s.remote)
294+
if s.l != nil { // notify listener
295+
s.l.closeSession(s.remote)
296+
}
295297

296298
s.mu.Lock()
297299
defer s.mu.Unlock()

0 commit comments

Comments
 (0)