controlplane: avoid calling Close on nil listener (#5156)

Tweak the cleanup logic in controlplane.NewServer() to avoid a nil panic
if the DebugListener fails to start.
This commit is contained in:
Kenneth Jenkins 2024-06-27 08:48:43 -07:00 committed by GitHub
parent 42a975ce44
commit f5f5e5fddc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -121,7 +121,7 @@ func NewServer(cfg *config.Config, metricsMgr *config.MetricsManager, eventsMgr
if err != nil {
_ = srv.GRPCListener.Close()
_ = srv.HTTPListener.Close()
_ = srv.DebugListener.Close()
_ = srv.MetricsListener.Close()
return nil, err
}