Skip to content

Commit 2e60f3a

Browse files
committed
DBG: Fixing invalid free (x64dbg#438)
1 parent 9755f6f commit 2e60f3a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/dbg/memory.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ void MemUpdateMap()
183183
}
184184
}
185185

186-
BridgeFree(threadList.list);
186+
// Only free thread data if it was allocated
187+
if (threadList.list)
188+
BridgeFree(threadList.list);
187189

188190
// Convert the vector to a map
189191
EXCLUSIVE_ACQUIRE(LockMemoryPages);

src/dbg/thread.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ void ThreadGetList(THREADLIST* List)
7676
// Also assume BridgeAlloc zeros the returned buffer.
7777
//
7878
List->count = (int)threadList.size();
79+
List->list = nullptr;
7980

8081
if (List->count <= 0)
8182
return;

0 commit comments

Comments
 (0)