Skip to content

Commit

Permalink
Fix nasa#1985, Check return value of CFE_ES_PutPoolBuf
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Apr 19, 2024
1 parent 28a5820 commit 292e018
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion modules/sb/fsw/src/cfe_sb_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,23 @@ CFE_SB_BufferD_t *CFE_SB_GetBufferFromPool(size_t MaxMsgSize)
*-----------------------------------------------------------------*/
void CFE_SB_ReturnBufferToPool(CFE_SB_BufferD_t *bd)
{
int32 Status;

/* Remove from any tracking list (no effect if not in a list) */
CFE_SB_TrackingListRemove(&bd->Link);

--CFE_SB_Global.StatTlmMsg.Payload.SBBuffersInUse;
CFE_SB_Global.StatTlmMsg.Payload.MemInUse -= bd->AllocatedSize;

/* finally give the buf descriptor back to the buf descriptor pool */
CFE_ES_PutPoolBuf(CFE_SB_Global.Mem.PoolHdl, bd);
Status = CFE_ES_PutPoolBuf(CFE_SB_Global.Mem.PoolHdl, bd);

if (Status < 0)
{
CFE_ES_WriteToSysLog("%s: PutPoolBuf Fail Stat=0x%08X, Hndl=0x%08lX, Buf=0x%08lX\n", __func__,
(unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_SB_Global.Mem.PoolHdl),
(unsigned long)bd);
}
}

/*----------------------------------------------------------------
Expand Down

0 comments on commit 292e018

Please sign in to comment.