From 3055da2975977626af2b411af495c18e17ebfbb0 Mon Sep 17 00:00:00 2001 From: Adrian Serrano Date: Tue, 2 Apr 2019 11:00:51 +0200 Subject: [PATCH 1/2] Fix connection leak on SSL failure When connecting to a server using SSL fails (i.e. with SSL disabled) the connection was never freed. Fixes #840 --- conn.go | 1 + 1 file changed, 1 insertion(+) diff --git a/conn.go b/conn.go index df2dab22..9149350b 100644 --- a/conn.go +++ b/conn.go @@ -299,6 +299,7 @@ func (c *Connector) open(ctx context.Context) (cn *conn, err error) { err = cn.ssl(o) if err != nil { + cn.c.Close() return nil, err } From f0737054ab65130aa49462c6876a30bf998bc89f Mon Sep 17 00:00:00 2001 From: Adrian Serrano Date: Tue, 7 May 2019 16:28:33 +0200 Subject: [PATCH 2/2] Try to fix CI --- conn.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conn.go b/conn.go index 9149350b..3aa07ca3 100644 --- a/conn.go +++ b/conn.go @@ -299,7 +299,9 @@ func (c *Connector) open(ctx context.Context) (cn *conn, err error) { err = cn.ssl(o) if err != nil { - cn.c.Close() + if cn.c != nil { + cn.c.Close() + } return nil, err }