mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +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:
|
else:
|
||||||
result = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
result = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||||
result.settimeout(timeout)
|
result.settimeout(timeout)
|
||||||
result.connect(self.address)
|
try:
|
||||||
|
result.connect(self.address)
|
||||||
|
except OSError:
|
||||||
|
result.close() # Issue 19182
|
||||||
|
raise
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def createSocket(self):
|
def createSocket(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue