diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2013-10-06 17:36:00 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2013-10-06 17:36:00 (GMT) |
commit | 38c741c1fcd432fa8740bed263c82339f9cc0b70 (patch) | |
tree | f52d2acc93403041e8c297804328cf196c47c4d2 /Lib/logging | |
parent | fd115517100db5e868ef0c954f1191408687f21f (diff) | |
download | cpython-38c741c1fcd432fa8740bed263c82339f9cc0b70.zip cpython-38c741c1fcd432fa8740bed263c82339f9cc0b70.tar.gz cpython-38c741c1fcd432fa8740bed263c82339f9cc0b70.tar.bz2 |
Issue #19182: Fixed socket leak on exception when connecting.
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/handlers.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index b0b0a16..b2e7d44 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -518,7 +518,11 @@ class SocketHandler(logging.Handler): else: result = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) result.settimeout(timeout) - result.connect(self.address) + try: + result.connect(self.address) + except OSError: + result.close() # Issue 19182 + raise return result def createSocket(self): |