Free all messages in LpcpDeletePort.
Modified: trunk/reactos/ntoskrnl/lpc/close.c

Modified: trunk/reactos/ntoskrnl/lpc/close.c
--- trunk/reactos/ntoskrnl/lpc/close.c	2005-09-16 15:18:07 UTC (rev 17881)
+++ trunk/reactos/ntoskrnl/lpc/close.c	2005-09-16 15:18:23 UTC (rev 17882)
@@ -87,9 +87,27 @@
 VOID STDCALL
 LpcpDeletePort (PVOID	ObjectBody)
 {
-   //   PEPORT Port = (PEPORT)ObjectBody;
+   PLIST_ENTRY Entry;
+   PQUEUEDMESSAGE	Message;
 
-   //   DPRINT1("Deleting port %x\n", Port);
+   PEPORT Port = (PEPORT)ObjectBody;
+
+   DPRINT("Deleting port %x\n", Port);
+
+   /* Free all waiting messages */
+   while (!IsListEmpty(&Port->QueueListHead))
+     {
+       Entry = RemoveHeadList(&Port->QueueListHead);
+       Message = CONTAINING_RECORD (Entry, QUEUEDMESSAGE, QueueListEntry);
+       ExFreePool(Message);
+     }
+
+   while (!IsListEmpty(&Port->ConnectQueueListHead))
+     {
+       Entry = RemoveHeadList(&Port->ConnectQueueListHead);
+       Message = CONTAINING_RECORD (Entry, QUEUEDMESSAGE, QueueListEntry);
+       ExFreePool(Message);
+     }
 }