Issue #19182: Fixed socket leak on exception when connecting.

This commit is contained in:
Vinay Sajip 2013-10-06 18:36:00 +01:00
parent fd11551710
commit 38c741c1fc
1 changed files with 5 additions and 1 deletions

View File

@ -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):