Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #66, Re-acquire tbl data pointer in SC_ManageTable #67

Merged
merged 3 commits into from
Dec 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions fsw/src/sc_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,22 +815,23 @@ void SC_ManageTable(SC_TableType type, int32 ArrayIndex)
{
int32 Result;
CFE_TBL_Handle_t TblHandle;
uint32 * TblAddr;
uint32 ** TblAddr;
void * TblPtrNew;

switch (type)
{
case ATS:
TblHandle = SC_OperData.AtsTblHandle[ArrayIndex];
TblAddr = SC_OperData.AtsTblAddr[ArrayIndex];
TblAddr = &SC_OperData.AtsTblAddr[ArrayIndex];
break;
case RTS:
TblHandle = SC_OperData.RtsTblHandle[ArrayIndex];
TblAddr = SC_OperData.RtsTblAddr[ArrayIndex];
TblAddr = &SC_OperData.RtsTblAddr[ArrayIndex];
break;
case APPEND:
default:
TblHandle = SC_OperData.AppendTblHandle;
TblAddr = SC_OperData.AppendTblAddr;
TblAddr = &SC_OperData.AppendTblAddr;
break;
}

Expand All @@ -841,7 +842,8 @@ void SC_ManageTable(SC_TableType type, int32 ArrayIndex)
CFE_TBL_Manage(TblHandle);

/* Re-acquire table data pointer */
Result = CFE_TBL_GetAddress((void *)&TblAddr, TblHandle);
Result = CFE_TBL_GetAddress(&TblPtrNew, TblHandle);
*TblAddr = TblPtrNew; /* Note that CFE_TBL_GetAddress() sets this to NULL if it fails */
if (Result == CFE_TBL_INFO_UPDATED)
{
/* Process new table data */
Expand Down Expand Up @@ -879,4 +881,5 @@ void SC_ManageTable(SC_TableType type, int32 ArrayIndex)
"ATS Append table manage process error: Result = 0x%X", (unsigned int)Result);
}
}
}

} /* End SC_ManageTable() */