[ros-diffs] [cgutman] 40258: - Fix several handle leaks

cgutman at svn.reactos.org cgutman at svn.reactos.org
Fri Mar 27 04:21:22 CET 2009


Author: cgutman
Date: Fri Mar 27 06:21:21 2009
New Revision: 40258

URL: http://svn.reactos.org/svn/reactos?rev=40258&view=rev
Log:
 - Fix several handle leaks

Modified:
    trunk/reactos/dll/win32/msafd/misc/dllmain.c

Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllmain.c?rev=40258&r1=40257&r2=40258&view=diff
==============================================================================
--- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Fri Mar 27 06:21:21 2009
@@ -402,6 +402,7 @@
     /* If a Close is already in Process, give up */
     if (Socket->SharedData.State == SocketClosed)
     {
+        NtClose(SockEvent);
         *lpErrno = WSAENOTSOCK;
         return SOCKET_ERROR;
     }
@@ -447,6 +448,7 @@
              */
             if (Socket->SharedData.NonBlocking)
             {
+                NtClose(SockEvent);
                 Socket->SharedData.State = OldState;
                 *lpErrno = WSAEWOULDBLOCK;
                 return SOCKET_ERROR;
@@ -504,6 +506,7 @@
 
     /* Close the handle */
     NtClose((HANDLE)Handle);
+    NtClose(SockEvent);
 
     return NO_ERROR;
 }
@@ -951,7 +954,10 @@
     WSPSelect(0, &ReadSet, NULL, NULL, &Timeout, NULL);
 
     if (ReadSet.fd_array[0] != Socket->Handle)
+    {
+        NtClose(SockEvent);
         return 0;
+    }
 
     /* Send IOCTL */
     Status = NtDeviceIoControlFile((HANDLE)Socket->Handle,
@@ -1199,6 +1205,7 @@
 
     if (!NT_SUCCESS(Status))
     {
+        NtClose(SockEvent);
         WSPCloseSocket( AcceptSocket, lpErrno );
         MsafdReturnWithErrno( Status, lpErrno, 0, NULL );
         return INVALID_SOCKET;



More information about the Ros-diffs mailing list