Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

[Fix] Memory leak with CSList::ThrowAll() in NTFS_Common.h #269

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Exfiltration/NTFSParser/NTFSParser/NTFS_Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,15 @@ class CSList
// Caution! All entries are just thrown without free
__inline void ThrowAll()
{
// Must free NTSLIST_ENTRY because InsertEntry() doesn't copy this pointer
while (ListHead)
{
ListCurrent = ListHead->Next;
ListHead->Entry = NULL;
delete ListHead;

ListHead = ListCurrent;
}
ListHead = ListTail = NULL;
ListCurrent = NULL;
EntryCount = 0;
Expand Down
9 changes: 9 additions & 0 deletions Exfiltration/NTFSParser/NTFSParserDLL/NTFS_Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,15 @@ class CSList
// Caution! All entries are just thrown without free
__inline void ThrowAll()
{
// Must free NTSLIST_ENTRY because InsertEntry() doesn't copy this pointer
while (ListHead)
{
ListCurrent = ListHead->Next;
ListHead->Entry = NULL;
delete ListHead;

ListHead = ListCurrent;
}
ListHead = ListTail = NULL;
ListCurrent = NULL;
EntryCount = 0;
Expand Down