- Do not dereference hook objects when it's not needed.
 - Avoid use after free.
CORE-8698 #resolve

svn path=/trunk/; revision=64954
This commit is contained in:
Jérôme Gardou
2014-10-24 11:34:55 +00:00
parent 7540c2ea36
commit 97fcf61354
+3 -3
View File
@@ -1294,12 +1294,14 @@ IntUnhookWindowsHook(int HookId, HOOKPROC pfnFilterProc)
{
Hook = CONTAINING_RECORD(pElement, HOOK, Chain);
/* Get the next element now, we might free the hook in what follows */
pElement = Hook->Chain.Flink;
if (Hook->Proc == pfnFilterProc)
{
if (Hook->head.pti == pti)
{
IntRemoveHook(Hook);
UserDereferenceObject(Hook);
return TRUE;
}
else
@@ -1308,8 +1310,6 @@ IntUnhookWindowsHook(int HookId, HOOKPROC pfnFilterProc)
return FALSE;
}
}
pElement = Hook->Chain.Flink;
}
}
return FALSE;