From bae216e9d296e7b3fcaf8f903c3e64f3d76cc6b3 Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Fri, 16 Sep 2005 15:18:23 +0000 Subject: [PATCH] Free all messages in LpcpDeletePort. svn path=/trunk/; revision=17882 --- reactos/ntoskrnl/lpc/close.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/lpc/close.c b/reactos/ntoskrnl/lpc/close.c index b36162fff4d..1091bfcc837 100644 --- a/reactos/ntoskrnl/lpc/close.c +++ b/reactos/ntoskrnl/lpc/close.c @@ -87,9 +87,27 @@ LpcpClosePort (PVOID ObjectBody, ULONG HandleCount) 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); + } }