summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2013-10-06 17:36:00 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2013-10-06 17:36:00 (GMT)
commit38c741c1fcd432fa8740bed263c82339f9cc0b70 (patch)
treef52d2acc93403041e8c297804328cf196c47c4d2 /Lib/logging
parentfd115517100db5e868ef0c954f1191408687f21f (diff)
downloadcpython-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.py6
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):