Commit 41c4e965 authored by Zihong Zheng's avatar Zihong Zheng

Fix potential nil pointer dereference for kube-proxy healthcheck

parent cbd6b25c
......@@ -197,7 +197,13 @@ var _ http.Handler = hcHandler{}
func (h hcHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
h.hcs.lock.Lock()
count := h.hcs.services[h.name].endpoints
svc, ok := h.hcs.services[h.name]
if !ok || svc == nil {
h.hcs.lock.Unlock()
glog.Errorf("Received request for closed healthcheck %q", h.name.String())
return
}
count := svc.endpoints
h.hcs.lock.Unlock()
resp.Header().Set("Content-Type", "application/json")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment