commit | c3454f0e79b35fb81b0426cfac4b801d4495b8ea | [log] [tgz] |
---|---|---|
author | Stéphane Wirtel <stephane@wirtel.be> | Wed May 24 20:59:06 2017 +0200 |
committer | Xiang Zhang <angwerzx@126.com> | Thu May 25 02:59:06 2017 +0800 |
tree | 953ccedb141b8ec7a4dd468d4d3d552f9524933a | |
parent | 9bcf81da1436468c3c5e500ae36678a2ad675e32 [diff] |
bpo-30394: Fix a socket leak in smtplib.SMTP.__init__() (#1700) (#1790)
diff --git a/Lib/smtplib.py b/Lib/smtplib.py index f7c2c77..5e422b7 100755 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py
@@ -250,6 +250,7 @@ if host: (code, msg) = self.connect(host, port) if code != 220: + self.close() raise SMTPConnectError(code, msg) if local_hostname is not None: self.local_hostname = local_hostname