[sm] Fix process unregistering logic bug (fixes #984)
In this case pm+sm were supposed to automatically unregister ro's services (the kernel can close a dying process's handle automatically). Not doing this apparently induced a reference leak of DevMenu's as a process, preventing it to be destroyed and the memory allocation reslimit counter to be updated by KProcess's destructor accordingly.
This commit is contained in:
parent
2a840f2c79
commit
1572bfd989
@ -58,13 +58,16 @@ Result UnregisterProcess(u32 pid)
|
|||||||
svcCloseHandle(processData->notificationSemaphore);
|
svcCloseHandle(processData->notificationSemaphore);
|
||||||
|
|
||||||
// Unregister the services registered by the process
|
// Unregister the services registered by the process
|
||||||
for(u32 i = 0; i < nbServices; i++)
|
u32 i = 0;
|
||||||
|
while(i < nbServices)
|
||||||
{
|
{
|
||||||
if(servicesInfo[i].pid == pid)
|
if(servicesInfo[i].pid == pid)
|
||||||
{
|
{
|
||||||
svcCloseHandle(servicesInfo[i].clientPort);
|
svcCloseHandle(servicesInfo[i].clientPort);
|
||||||
servicesInfo[i] = servicesInfo[--nbServices];
|
servicesInfo[i] = servicesInfo[--nbServices];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
moveNode(processData, &freeProcessDataList, false);
|
moveNode(processData, &freeProcessDataList, false);
|
||||||
|
Reference in New Issue
Block a user