Skip to content

Commit ecf2edd

Browse files
authored
Merge pull request #232 from JacobBarthelmeh/misc
Minor adjustment to RNG free in test case and null check in TCP getter function
2 parents d3f43c9 + 0816fc1 commit ecf2edd

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

port/posix/posix_transport_tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ int posixTransportTcp_GetConnectFd(posixTransportTcpClientContext *context,
454454
case PTT_STATE_CONNECT_WAIT:
455455
case PTT_STATE_CONNECTED:
456456
ret = WH_ERROR_OK;
457-
if (*out_fd) {
457+
if (out_fd) {
458458
*out_fd = context->connect_fd_p1 - 1;
459459
}
460460
break;

test/wh_test_crypto.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3734,6 +3734,7 @@ int whTestCrypto_MlDsaVerifyOnlyDma(whClientContext* ctx, int devId,
37343734
int whTest_CryptoClientConfig(whClientConfig* config)
37353735
{
37363736
int i;
3737+
int rngInited = 0;
37373738
whClientContext client[1] = {0};
37383739
int ret = 0;
37393740
/* wolfcrypt */
@@ -3775,6 +3776,9 @@ int whTest_CryptoClientConfig(whClientConfig* config)
37753776
if (ret != 0) {
37763777
WH_ERROR_PRINT("Failed to reinitialize RNG %d\n", ret);
37773778
}
3779+
else {
3780+
rngInited = 1;
3781+
}
37783782
}
37793783

37803784
if (ret == 0) {
@@ -3935,7 +3939,9 @@ int whTest_CryptoClientConfig(whClientConfig* config)
39353939
#endif /* WOLFHSM_CFG_TEST_VERBOSE */
39363940

39373941
/* Clean up used resources */
3938-
(void)wc_FreeRng(rng);
3942+
if (rngInited) {
3943+
(void)wc_FreeRng(rng);
3944+
}
39393945
(void)wh_Client_CommClose(client);
39403946
(void)wh_Client_Cleanup(client);
39413947

0 commit comments

Comments
 (0)