mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
device manager: don't do operations on nil pointer.
If grpc.DialContext() fails, a nil connection is returned. Check the error before calling conn.Close().
This commit is contained in:
parent
abdfd7cebf
commit
dd3eeb3f46
@ -165,10 +165,10 @@ func (m *Stub) Register(kubeletEndpoint, resourceName string, pluginSockDir stri
|
||||
grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
|
||||
return net.DialTimeout("unix", addr, timeout)
|
||||
}))
|
||||
defer conn.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer conn.Close()
|
||||
client := pluginapi.NewRegistrationClient(conn)
|
||||
reqt := &pluginapi.RegisterRequest{
|
||||
Version: pluginapi.Version,
|
||||
|
Loading…
Reference in New Issue
Block a user