1. mirror
  2. cpython

Commits

Vinay Sajip  committed bd314db

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

  • Participants
  • Parent commits aeb7a5b
  • Branches default

Comments (0)

Files changed (1)

File Lib/logging/handlers.py

View file
  • Ignore whitespace
         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):