https://git.reactos.org/?p=reactos.git;a=commitdiff;h=abdde0b764540617fd99e…
commit abdde0b764540617fd99ef397287421a3ace1dfc
Author: Bișoc George <fraizeraust99(a)gmail.com>
AuthorDate: Sun Feb 11 22:56:38 2018 +0100
Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Feb 11 22:56:38 2018 +0100
[EXPLORER] WatchList should be freed with delete[], not delete (#374)
WatchList is a set of array objects, initialized with "new[]", so it should
be freed with "delete[]" to free all of its elements. Otherwise using only
"delete" only frees the first variable but not its array. This would lead to an
undefined behaviour.
---
base/shell/explorer/syspager.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/base/shell/explorer/syspager.cpp b/base/shell/explorer/syspager.cpp
index 0fa8eae4e3..a1982e7881 100644
--- a/base/shell/explorer/syspager.cpp
+++ b/base/shell/explorer/syspager.cpp
@@ -413,7 +413,7 @@ UINT WINAPI CIconWatcher::WatcherThread(_In_opt_ LPVOID lpParam)
ASSERT(Size <= MAXIMUM_WAIT_OBJECTS);
if (WatchList)
- delete WatchList;
+ delete[] WatchList;
WatchList = new HANDLE[Size];
WatchList[0] = This->m_WakeUpEvent;
@@ -479,7 +479,7 @@ UINT WINAPI CIconWatcher::WatcherThread(_In_opt_ LPVOID lpParam)
}
if (WatchList)
- delete WatchList;
+ delete[] WatchList;
return 0;
}