Skip to content

Commit

Permalink
Fix connection leak on SSL failure
Browse files Browse the repository at this point in the history
When connecting to a server using SSL fails (i.e. with SSL disabled)
the connection was never freed.

Fixes #840
  • Loading branch information
Adrian Serrano authored and maddyblue committed May 7, 2019
1 parent ceb88a0 commit 2ff3cb3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ func (c *Connector) open(ctx context.Context) (cn *conn, err error) {

err = cn.ssl(o)
if err != nil {
if cn.c != nil {
cn.c.Close()
}
return nil, err
}

Expand Down

0 comments on commit 2ff3cb3

Please sign in to comment.