diff options
author | Joel Hillacre <joel@403forbidden.ca> | 2017-05-24 05:14:50 (GMT) |
---|---|---|
committer | Xiang Zhang <angwerzx@126.com> | 2017-05-24 05:14:50 (GMT) |
commit | 9e98cd0383d9e7f06c0537038a32459bf5efa97a (patch) | |
tree | 0a595ab8f436866301066f173c7190de80a0d299 /Lib/smtplib.py | |
parent | 1abcf6700b4da6207fe859de40c6c1bada6b4fec (diff) | |
download | cpython-9e98cd0383d9e7f06c0537038a32459bf5efa97a.zip cpython-9e98cd0383d9e7f06c0537038a32459bf5efa97a.tar.gz cpython-9e98cd0383d9e7f06c0537038a32459bf5efa97a.tar.bz2 |
bpo-30394: Fix a socket leak in smtplib.SMTP.__init__() (#1700)
Diffstat (limited to 'Lib/smtplib.py')
-rwxr-xr-x | Lib/smtplib.py | 1 |
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 |