summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphane Wirtel <stephane@wirtel.be>2017-05-24 18:59:06 (GMT)
committerXiang Zhang <angwerzx@126.com>2017-05-24 18:59:06 (GMT)
commitc3454f0e79b35fb81b0426cfac4b801d4495b8ea (patch)
tree953ccedb141b8ec7a4dd468d4d3d552f9524933a
parent9bcf81da1436468c3c5e500ae36678a2ad675e32 (diff)
downloadcpython-c3454f0e79b35fb81b0426cfac4b801d4495b8ea.zip
cpython-c3454f0e79b35fb81b0426cfac4b801d4495b8ea.tar.gz
cpython-c3454f0e79b35fb81b0426cfac4b801d4495b8ea.tar.bz2
bpo-30394: Fix a socket leak in smtplib.SMTP.__init__() (#1700) (#1790)
-rwxr-xr-xLib/smtplib.py1
1 files changed, 1 insertions, 0 deletions
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 @@ class SMTP:
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