Implement resource cleanup for failed allocations during idle thread setup
All checks were successful
Builds / ExectOS (i686, debug) (push) Successful in 45s
Builds / ExectOS (amd64, release) (push) Successful in 47s
Builds / ExectOS (amd64, debug) (push) Successful in 47s
Builds / ExectOS (i686, release) (push) Successful in 45s

This commit is contained in:
2026-06-04 14:36:43 +02:00
parent 53a239958f
commit f680830b53
3 changed files with 17 additions and 4 deletions

View File

@@ -82,7 +82,8 @@ KE::KProcess::InitializeIdleProcess(IN OUT PKPROCESS Process,
Status = MM::Allocator::AllocatePool(NonPagedPool, MapSize, (PVOID*)&Process->ActiveProcessors);
if(Status != STATUS_SUCCESS)
{
/* Memory allocation failed, return the status code */
/* Memory allocation failed, free previously allocated memory and return the status code */
MM::Allocator::FreePool((PVOID)Process->Affinity);
return Status;
}

View File

@@ -75,7 +75,8 @@ KE::KThread::InitializeIdleThread(IN PKPROCESS IdleProcess,
Status = MM::Allocator::AllocatePool(NonPagedPool, MapSize, (PVOID*)&IdleThread->UserAffinity);
if(Status != STATUS_SUCCESS)
{
/* Memory allocation failed, return the status code */
/* Memory allocation failed, free previously allocated memory and return the status code */
MM::Allocator::FreePool((PVOID)IdleThread->Affinity);
return Status;
}
@@ -88,7 +89,9 @@ KE::KThread::InitializeIdleThread(IN PKPROCESS IdleProcess,
NULLPTR, NULLPTR, Stack, TRUE);
if(Status != STATUS_SUCCESS)
{
/* Failed to initialize IDLE thread, return status code */
/* Failed to initialize IDLE thread, free both affinity maps and return the status code */
MM::Allocator::FreePool((PVOID)IdleThread->Affinity);
MM::Allocator::FreePool((PVOID)IdleThread->UserAffinity);
return Status;
}