]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
In dealloc(), only close the socket if fd != -1.
authorGuido van Rossum <guido@python.org>
Mon, 10 Apr 2000 12:45:45 +0000 (12:45 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 10 Apr 2000 12:45:45 +0000 (12:45 +0000)
Modules/socketmodule.c

index bc8c9ae6175e478c83a3b27c5ee5041f6a9e6ad5..b96ba657af52ec806106636d805ffce0be0eed9b 100644 (file)
@@ -1356,7 +1356,8 @@ static PyMethodDef PySocketSock_methods[] = {
 static void
 BUILD_FUNC_DEF_1(PySocketSock_dealloc,PySocketSockObject *,s)
 {
-       (void) close(s->sock_fd);
+       if (s->sock_fd != -1)
+               (void) close(s->sock_fd);
        PyMem_DEL(s);
 }