From 544872a30ec64a366adf58381951ba9ad3b9a319 Mon Sep 17 00:00:00 2001 From: Avi Date: Tue, 8 Nov 2022 18:01:47 +1000 Subject: [PATCH] Fix #1461, Move data lock to inside of if block --- modules/sb/fsw/src/cfe_sb_api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/sb/fsw/src/cfe_sb_api.c b/modules/sb/fsw/src/cfe_sb_api.c index bc4280ece..d2fac8b7a 100644 --- a/modules/sb/fsw/src/cfe_sb_api.c +++ b/modules/sb/fsw/src/cfe_sb_api.c @@ -2103,16 +2103,16 @@ CFE_Status_t CFE_SB_ReleaseMessageBuffer(CFE_SB_Buffer_t *BufPtr) Status = CFE_SB_ZeroCopyBufferValidate(BufPtr, &BufDscPtr); - CFE_SB_LockSharedData(__func__, __LINE__); - if (Status == CFE_SUCCESS) { + CFE_SB_LockSharedData(__func__, __LINE__); + /* Clear the ownership app ID and decrement use count (may also free) */ BufDscPtr->AppId = CFE_ES_APPID_UNDEFINED; CFE_SB_DecrBufUseCnt(BufDscPtr); - } - CFE_SB_UnlockSharedData(__func__, __LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); + } return Status; }