From 2be951a582ce0a58b71c04b63bcf9c1bb38dd2e5 Mon Sep 17 00:00:00 2001 From: Mihai Parparita Date: Mon, 31 Oct 2022 14:05:43 -0700 Subject: [PATCH] cmd/tsconnect: fix null pointer dereference when DNS lookups fail If we never had a chance to open the SSH session we should not try to close it. Fixes #6089 Signed-off-by: Mihai Parparita --- cmd/tsconnect/wasm/wasm_js.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/tsconnect/wasm/wasm_js.go b/cmd/tsconnect/wasm/wasm_js.go index e33a5797d..5ff163398 100644 --- a/cmd/tsconnect/wasm/wasm_js.go +++ b/cmd/tsconnect/wasm/wasm_js.go @@ -463,6 +463,10 @@ func (s *jsSSHSession) Run() { } func (s *jsSSHSession) Close() error { + if s.session == nil { + // We never had a chance to open the session, ignore the close request. + return nil + } return s.session.Close() }