ExtendedTools: Fix memory leak when restarting etw providers
@@ -88,6 +88,11 @@ VOID EtEtwMonitorInitialization(
if (PhGetOwnTokenAttributes().Elevated && PhGetIntegerSetting(SETTING_NAME_ENABLE_ETW_MONITOR))
{
EtStartEtwSession();
+
+ if (EtEtwEnabled)
+ {
+ PhCreateThread2(EtpEtwMonitorThreadStart, NULL);
+ }
}
}
@@ -232,11 +237,6 @@ VOID EtStartEtwSession(
EtpStartedSession = FALSE;
EtpSessionHandle = INVALID_PROCESSTRACE_HANDLE; // StartTrace set the handle 0 on failure. (dmex)
}
-
- if (EtEtwEnabled)
- {
- PhCreateThread2(EtpEtwMonitorThreadStart, NULL);
- }
}
ULONG EtControlEtwSession(
