diff --git a/dll/win32/syssetup/proppage.c b/dll/win32/syssetup/proppage.c index 4072b224fda..0c1fcb08d1c 100644 --- a/dll/win32/syssetup/proppage.c +++ b/dll/win32/syssetup/proppage.c @@ -490,9 +490,15 @@ MouseCallback( UINT uMsg, LPPROPSHEETPAGE ppsp) { + PMOUSE_INFO pMouseInfo; + + pMouseInfo = (PMOUSE_INFO)ppsp->lParam; + if (uMsg == PSPCB_RELEASE) { - HeapFree(GetProcessHeap(), 0, (PMOUSE_INFO)ppsp->lParam); + if (pMouseInfo->hDeviceKey != NULL) + RegCloseKey(pMouseInfo->hDeviceKey); + HeapFree(GetProcessHeap(), 0, pMouseInfo); } return 1;