nasa / CF

The Core Flight System (cFS) CFDP application.
Apache License 2.0
86 stars 46 forks source link

CF CF_CFDP_MsgOutGet method double checks msg for NULL #29

Closed jphickey closed 2 years ago

jphickey commented 2 years ago

This issue was imported from the GSFC issue tracking system

Imported from: [GSFCCFS-1727] CF CF_CFDP_MsgOutGet method double checks msg for NULL Originally submitted by: Gibson, Alan S. (GSFC-5870) on Mon Sep 13 09:59:14 2021

Original Description: The function CF_CFDP_MsgOutGet in cf_cfdp.c checks if(!CF_AppData.engine.out.msg) (line 356) as a top if block; however, it then checks it again as part of the if block
if(!CF_AppData.engine.out.msg&&((CF_AppData.config_table->chan[t->chan_num].sem_name[0]&&                     (OS_CountSemTimedWait(c->sem_id, 0)==OS_SUCCESS))||                     (!CF_AppData.config_table->chan[t->chan_num].sem_name[0])))
(starting on line 365 <- yep not a typo line 356 and 365, funny), but there is nothing in between that could change it.

It would appear that this check in the second if is not required.

jphickey commented 2 years ago

This was cleaned up as part of moving this code to a separate file (cf_cfdp_sbintf.c) as part of #137.