[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:
TuxSH 2017-12-27 19:30:57 +01:00
parent 2a840f2c79
commit 1572bfd989

View File

@ -58,13 +58,16 @@ Result UnregisterProcess(u32 pid)
svcCloseHandle(processData->notificationSemaphore);
// 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)
{
svcCloseHandle(servicesInfo[i].clientPort);
servicesInfo[i] = servicesInfo[--nbServices];
}
else
++i;
}
moveNode(processData, &freeProcessDataList, false);