Skip to content

Commit 8359bf4

Browse files
committed
BUG/MINOR: events: fix nil dereference panic in Stop()
Stop() called h.listener.Close() without checking if listener is nil. After Reset() sets listener to nil, or if the connection was never established, calling Stop() would panic.
1 parent 05235e5 commit 8359bf4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

client-native/events.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ func (h *HAProxyEventListener) Reset() {
116116

117117
func (h *HAProxyEventListener) Stop() error {
118118
h.stop.Store(true)
119-
return h.listener.Close()
119+
if h.listener != nil {
120+
return h.listener.Close()
121+
}
122+
return nil
120123
}
121124

122125
func newHAProxyEventListener(socketPath string) (*runtime.EventListener, error) {

0 commit comments

Comments
 (0)