[ros-diffs] [greatlrd] 22506: Bugfix from w3seek : bug 1614 Fix resource leak in NtRemoveIoCompletion

greatlrd at svn.reactos.org greatlrd at svn.reactos.org
Thu Jun 22 22:30:50 CEST 2006


Author: greatlrd
Date: Fri Jun 23 00:30:49 2006
New Revision: 22506

URL: http://svn.reactos.ru/svn/reactos?rev=22506&view=rev
Log:
Bugfix from w3seek : bug 1614 Fix resource leak in NtRemoveIoCompletion

Modified:
    trunk/reactos/ntoskrnl/io/iocomp.c

Modified: trunk/reactos/ntoskrnl/io/iocomp.c
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/io/iocomp.c?rev=22506&r1=22505&r2=22506&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iocomp.c (original)
+++ trunk/reactos/ntoskrnl/io/iocomp.c Fri Jun 23 00:30:49 2006
@@ -279,7 +279,7 @@
             _SEH_TRY {
 
                 *IoCompletionHandle = hIoCompletionHandle;
-            } _SEH_HANDLE {
+            } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
 
                 Status = _SEH_GetExceptionCode();
             } _SEH_END;
@@ -332,7 +332,7 @@
         _SEH_TRY {
 
             *IoCompletionHandle = hIoCompletionHandle;
-        } _SEH_HANDLE {
+        } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
 
             Status = _SEH_GetExceptionCode();
         } _SEH_END;
@@ -393,7 +393,7 @@
 
                 *ResultLength = sizeof(IO_COMPLETION_BASIC_INFORMATION);
             }
-        } _SEH_HANDLE {
+        } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
 
             Status = _SEH_GetExceptionCode();
         } _SEH_END;
@@ -472,34 +472,40 @@
             /* Get the Packet Data */
             Packet = CONTAINING_RECORD(ListEntry, IO_COMPLETION_PACKET, ListEntry);
 
-            _SEH_TRY {
-
-                /* Check if this is piggybacked on an IRP */
-                if (Packet->PacketType == IrpCompletionPacket)
-                {
-                    /* Get the IRP */
-                    PIRP Irp = NULL;
-                    Irp = CONTAINING_RECORD(ListEntry, IRP, Tail.Overlay.ListEntry);
-                    
-                    /* Return values to user */
+            /* Check if this is piggybacked on an IRP */
+            if (Packet->PacketType == IrpCompletionPacket)
+            {
+                /* Get the IRP */
+                PIRP Irp = NULL;
+                Irp = CONTAINING_RECORD(ListEntry, IRP, Tail.Overlay.ListEntry);
+                
+                /* Return values to user */
+                _SEH_TRY {
+
                     *CompletionKey = Irp->Tail.CompletionKey;
                     *CompletionContext = Irp->Overlay.AsynchronousParameters.UserApcContext;
                     *IoStatusBlock = Packet->IoStatus;
-                    IoFreeIrp(Irp);
-                }
-                else
-                {
-                    /* This is a user-mode generated or API generated mini-packet */
+                } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
+
+                    Status = _SEH_GetExceptionCode();
+                } _SEH_END;
+
+                IoFreeIrp(Irp);
+            }
+            else
+            {
+                /* This is a user-mode generated or API generated mini-packet */
+                _SEH_TRY {
+
                     *CompletionKey = Packet->Key;
                     *CompletionContext = Packet->Context;
                     *IoStatusBlock = Packet->IoStatus;
-                    IopFreeIoCompletionPacket(Packet);
-                }
-
-            } _SEH_HANDLE {
-
-                Status = _SEH_GetExceptionCode();
-            } _SEH_END;
+                } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) {
+                    Status = _SEH_GetExceptionCode();
+                } _SEH_END;
+
+                IopFreeIoCompletionPacket(Packet);
+            }
         }
 
         /* Dereference the Object */




More information about the Ros-diffs mailing list