[NTUSER] Fix KVM and VBox tests (#4235)

KVM and VBox tests was failing since d5deacd
- Check NULL at UserFreeInputContext and UserDestroyInputContext functions.
- Move UserMarkObjectDestroy into the UserDestroyInputContext function.
CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2022-01-02 01:40:11 +09:00 committed by GitHub
parent ee132a05ba
commit 757bed81b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -224,10 +224,14 @@ AllocInputContextObject(PDESKTOP pDesk,
VOID UserFreeInputContext(PVOID Object) VOID UserFreeInputContext(PVOID Object)
{ {
PIMC pIMC = Object, pImc0; PIMC pIMC = Object, pImc0;
PTHREADINFO pti = pIMC->head.pti; PTHREADINFO pti;
UserMarkObjectDestroy(Object); if (!pIMC)
return;
pti = pIMC->head.pti;
/* Find the IMC in the list and remove it */
for (pImc0 = pti->spDefaultImc; pImc0; pImc0 = pImc0->pImcNext) for (pImc0 = pti->spDefaultImc; pImc0; pImc0 = pImc0->pImcNext)
{ {
if (pImc0->pImcNext == pIMC) if (pImc0->pImcNext == pIMC)
@ -237,7 +241,7 @@ VOID UserFreeInputContext(PVOID Object)
} }
} }
UserHeapFree(Object); UserHeapFree(pIMC);
pti->ppi->UserHandleCount--; pti->ppi->UserHandleCount--;
IntDereferenceThreadInfo(pti); IntDereferenceThreadInfo(pti);
@ -246,7 +250,11 @@ VOID UserFreeInputContext(PVOID Object)
BOOLEAN UserDestroyInputContext(PVOID Object) BOOLEAN UserDestroyInputContext(PVOID Object)
{ {
PIMC pIMC = Object; PIMC pIMC = Object;
UserDeleteObject(pIMC->head.h, TYPE_INPUTCONTEXT); if (pIMC)
{
UserMarkObjectDestroy(pIMC);
UserDeleteObject(pIMC->head.h, TYPE_INPUTCONTEXT);
}
return TRUE; return TRUE;
} }