Issue #19182: Fixed socket leak on exception when connecting.
This commit is contained in:
parent
fd11551710
commit
38c741c1fc
|
@ -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…
Reference in New Issue