Skip to content

Commit

Permalink
Merge pull request #2616 from tandharia:fix-2615-unloading-module
Browse files Browse the repository at this point in the history
Fix #2615, Unloading module after failed app start
  • Loading branch information
dzbaker committed Dec 10, 2024
2 parents fb8b648 + f35e304 commit 914ad7a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/es/fsw/src/cfe_es_apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ int32 CFE_ES_StartAppTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, CFE_
int32 CFE_ES_AppCreate(CFE_ES_AppId_t *ApplicationIdPtr, const char *AppName, const CFE_ES_AppStartParams_t *Params)
{
CFE_Status_t Status;
CFE_Status_t CleanupStatus;
CFE_ES_AppRecord_t *AppRecPtr;
CFE_ResourceId_t PendingResourceId = CFE_RESOURCEID_UNDEFINED;

Expand Down Expand Up @@ -799,6 +800,16 @@ int32 CFE_ES_AppCreate(CFE_ES_AppId_t *ApplicationIdPtr, const char *AppName, co
/*
* Set the table entry back to free
*/
if (OS_ObjectIdDefined(AppRecPtr->LoadStatus.ModuleId))
{
CleanupStatus = OS_ModuleUnload(AppRecPtr->LoadStatus.ModuleId);
if (CleanupStatus != OS_SUCCESS)
{
CFE_ES_WriteToSysLog("%s: Module (ID:0x%08lX) Unload failed. RC=%ld\n", __func__,
OS_ObjectIdToInteger(AppRecPtr->LoadStatus.ModuleId), (long)CleanupStatus);
}
}

CFE_ES_AppRecordSetFree(AppRecPtr);
PendingResourceId = CFE_RESOURCEID_UNDEFINED;
}
Expand Down

0 comments on commit 914ad7a

Please sign in to comment.