Browse code

Fix nil pointer derefence on failure to connect to containerd

Signed-off-by: Simão Reis <smnrsti@gmail.com>

Simão Reis authored on 2019/01/30 22:41:54
Showing 1 changed files
... ...
@@ -311,6 +311,8 @@ func (r *remote) monitorDaemon(ctx context.Context) {
311 311
 				delay = time.After(time.Duration(transientFailureCount) * 200 * time.Millisecond)
312 312
 				continue
313 313
 			}
314
+			client.Close()
315
+			client = nil
314 316
 		}
315 317
 
316 318
 		if system.IsProcessAlive(r.daemonPid) {
... ...
@@ -318,8 +320,6 @@ func (r *remote) monitorDaemon(ctx context.Context) {
318 318
 			r.killDaemon()
319 319
 		}
320 320
 
321
-		client.Close()
322
-		client = nil
323 321
 		r.daemonPid = -1
324 322
 		delay = nil
325 323
 		transientFailureCount = 0