mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #19182: Fixed socket leak on exception when connecting.
This commit is contained in:
parent
fd11551710
commit
38c741c1fc
1 changed files with 5 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue