-
Notifications
You must be signed in to change notification settings - Fork 56
Description
Describe the bug
The CFE_TBL_GetAddress() routine is one of the APIs that have multiple "success" codes. Although the intent/hope is to deprecate this (see nasa/cFE#483) - the current implementation still returns values other than CFE_SUCCESS. In particular the first time it is called after loading, one gets CFE_TBL_INFO_UPDATED.
To Reproduce
Run CFE with sample app and issue the "Process" command (2) and observe one gets an "error" message e.g.:
1980-012-14:03:57.00062 Sample App: Fail to get table address: 0x4c00000e
But that error code is actually a "success" response. If the same command is repeated, it works OK because it returns CFE_SUCCESS this time.
A bigger issue, however, is that the address acquired from the first invocation is not released.
Expected behavior
Should get address and release address correctly.
System observed on:
Ubuntu 20.04
Additional context
This is an excellent example of why multiple success responses are a bad idea. It is really a bug in the CFE_TBL API -- we didn't as if a table was updated, we only asked to get its pointer. If TBL services gives back a buffer pointer as requested, the response should be CFE_SUCCESS. The unnecessary over-complexity of the TBL API definitely causes usability problems.
But in the meantime one can change the check from status == CFE_SUCCESS to status < CFE_SUCCESS and it should resolve the resource leak issue here.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.