From cfd12914e1e5b414ae57426c159aab1b8eed8996 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 11 Mar 2020 23:13:32 -0700 Subject: [PATCH] fix: crash in serverInfo handler when ldap is configured (#9123) --- cmd/admin-handlers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/admin-handlers.go b/cmd/admin-handlers.go index 1012a632d..62e68fb42 100644 --- a/cmd/admin-handlers.go +++ b/cmd/admin-handlers.go @@ -1409,10 +1409,10 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque } else if ldapConn == nil { ldap.Status = "Not Configured" } else { + // Close ldap connection to avoid leaks. + ldapConn.Close() ldap.Status = "online" } - // Close ldap connection to avoid leaks. - defer ldapConn.Close() } log, audit := fetchLoggerInfo(cfg)