commit | 779e7c933e777270897b1e35fa9e5b12eee12af9 | [log] [tgz] |
---|---|---|
author | Stéphane Wirtel <stephane@wirtel.be> | Wed May 24 20:24:27 2017 +0200 |
committer | Xiang Zhang <angwerzx@126.com> | Thu May 25 02:24:27 2017 +0800 |
tree | 9704e78a3299141bf32b732f806e4a11fd8cfad2 | |
parent | 9395ca40f27a3e3c436ad1796c9194343511f057 [diff] [blame] |
bpo-30394: Fix a socket leak in smtplib.SMTP.__init__() (#1700) (#1788)
diff --git a/Lib/smtplib.py b/Lib/smtplib.py index e1651c0..0c61065 100755 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py
@@ -255,6 +255,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