Skip to content

Commit 4cd727a

Browse files
committed
Fixed catastrophic bug that fragmented the heap, because I was accessing recently freed memory
1 parent a293c85 commit 4cd727a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

SimpleWindowSwitcher/sws_WindowSwitcher.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,8 @@ static sws_window _sws_WindowSwitcher_WindowList_PushToFront(sws_WindowSwitcher*
497497
sws_window zero;
498498
ZeroMemory(&zero, sizeof(sws_window));
499499
sws_vector_PushBack(&(_this->pHWNDList), &zero);
500+
// Reaquire list as vector may have been reallocated
501+
pHWNDList = _this->pHWNDList.pList;
500502
for (int i = _this->pHWNDList.cbSize - 1; i > 0; i--)
501503
{
502504
pHWNDList[i] = pHWNDList[i - 1];

0 commit comments

Comments
 (0)