Module: wine Branch: master Commit: 52f08dd510dfb94791a16d328756e6cf63300589 URL: http://source.winehq.org/git/wine.git/?a=commit;h=52f08dd510dfb94791a16d3287...
Author: Rob Shearman rob@codeweavers.com Date: Wed Jan 9 10:33:19 2008 +0000
rpcrt4: Fix memory leak in NdrFullPointerXlatFree.
First of all, the code was freeing the wrong pointer (i.e. the pointer supplied by the caller of one of the NdrFullPointer* functions, not the PFULL_PTR_TO_REFID_ELEMENT. Second, the code wasn't following the Next link to the next entry in the list.
---
dlls/rpcrt4/ndr_fullpointer.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/rpcrt4/ndr_fullpointer.c b/dlls/rpcrt4/ndr_fullpointer.c index 3586bc3..307e545 100644 --- a/dlls/rpcrt4/ndr_fullpointer.c +++ b/dlls/rpcrt4/ndr_fullpointer.c @@ -68,8 +68,17 @@ void WINAPI NdrFullPointerXlatFree(PFULL_PTR_XLAT_TABLES pXlatTables) TRACE("(%p)\n", pXlatTables);
/* free the entries in the table */ - for (i = 0; i < pXlatTables->RefIdToPointer.NumberOfEntries; i++) - HeapFree(GetProcessHeap(), 0, pXlatTables->RefIdToPointer.XlatTable[i]); + for (i = 0; i < pXlatTables->PointerToRefId.NumberOfBuckets; i++) + { + PFULL_PTR_TO_REFID_ELEMENT XlatTableEntry; + for (XlatTableEntry = pXlatTables->PointerToRefId.XlatTable[i]; + XlatTableEntry; ) + { + PFULL_PTR_TO_REFID_ELEMENT Next = XlatTableEntry->Next; + HeapFree(GetProcessHeap(), 0, XlatTableEntry); + XlatTableEntry = Next; + } + }
HeapFree(GetProcessHeap(), 0, pXlatTables->RefIdToPointer.XlatTable); HeapFree(GetProcessHeap(), 0, pXlatTables->RefIdToPointer.StateTable);