Author: cwittich Date: Fri Jan 18 13:37:37 2008 New Revision: 31852
URL: http://svn.reactos.org/svn/reactos?rev=31852&view=rev Log: rpcrt4: Fix memory leak in NdrFullPointerXlatFree. <rob at codeweavers.com>
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.
Modified: trunk/reactos/dll/win32/rpcrt4/ndr_fullpointer.c
Modified: trunk/reactos/dll/win32/rpcrt4/ndr_fullpointer.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/ndr_fullpo... ============================================================================== --- trunk/reactos/dll/win32/rpcrt4/ndr_fullpointer.c (original) +++ trunk/reactos/dll/win32/rpcrt4/ndr_fullpointer.c Fri Jan 18 13:37:37 2008 @@ -68,8 +68,17 @@ 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);