Skip to content

Commit 88a73c4

Browse files
committed
test_lTCPWindowTxAdd_nothing_to_do(): Fix TCP window initialization
Under Gcc 11, this expression in the tested function lTCPWindowTxAdd() was always true, leading to imperfect coverage: pxSegment->lDataLength < pxSegment->lMaxLength With Gcc 13, they were both 0. Let's add zero-initialization to make this what's tested for.
1 parent 66e54ed commit 88a73c4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/unit-test/FreeRTOS_TCP_WIN/FreeRTOS_TCP_WIN_utest.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,13 +1050,14 @@ void test_lTCPWindowTxAdd_nothing_to_do( void )
10501050
{
10511051
int32_t lDone;
10521052
TCPWindow_t xWindow = { 0 };
1053+
TCPSegment_t xSegment = { 0 };
10531054
uint32_t ulLength = 0;
10541055
int32_t lPosition = 0;
10551056
int32_t lMax = 0;
10561057
BaseType_t xBackup = xTCPWindowLoggingLevel;
10571058

10581059
/* in real code, this points to a list of segments */
1059-
xWindow.pxHeadSegment = malloc( sizeof( TCPSegment_t ) );
1060+
xWindow.pxHeadSegment = &xSegment;
10601061

10611062
xTCPWindowLoggingLevel = 3;
10621063

@@ -1068,7 +1069,6 @@ void test_lTCPWindowTxAdd_nothing_to_do( void )
10681069
TEST_ASSERT_EQUAL( 0, lDone );
10691070

10701071
xTCPWindowLoggingLevel = xBackup;
1071-
free( xWindow.pxHeadSegment );
10721072
}
10731073

10741074
void test_lTCPWindowTxAdd_null_txSegment( void )

0 commit comments

Comments
 (0)