Skip to content

Commit 6e14889

Browse files
authored
Merge pull request #8094 from JacobBarthelmeh/coverity
minor fixes for Coverity reports
2 parents beeda7b + f21a763 commit 6e14889

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

src/x509.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14121,7 +14121,9 @@ int wolfSSL_X509_check_ip_asc(WOLFSSL_X509 *x, const char *ipasc,
1412114121
}
1412214122

1412314123
#ifdef WOLFSSL_SMALL_STACK
14124-
XFREE(dCert, x->heap, DYNAMIC_TYPE_DCERT);
14124+
if (x != NULL) {
14125+
XFREE(dCert, x->heap, DYNAMIC_TYPE_DCERT);
14126+
}
1412514127
#endif
1412614128

1412714129
return ret;

wolfcrypt/test/test.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13939,6 +13939,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_cbc_test(void)
1393913939
if ((bigCipher == NULL) ||
1394013940
(bigPlain == NULL)) {
1394113941
XFREE(bigCipher, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
13942+
XFREE(bigPlain, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
1394213943
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
1394313944
}
1394413945
#else
@@ -35116,6 +35117,16 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t curve25519_test(void)
3511635117
(void)x;
3511735118
WOLFSSL_ENTER("curve25519_test");
3511835119

35120+
/* wc_FreeRng is always called on exit. Therefore wc_InitRng should be
35121+
* called before any exit goto's */
35122+
#ifndef HAVE_FIPS
35123+
ret = wc_InitRng_ex(&rng, HEAP_HINT, devId);
35124+
#else
35125+
ret = wc_InitRng(&rng);
35126+
#endif
35127+
if (ret != 0)
35128+
return WC_TEST_RET_ENC_EC(ret);
35129+
3511935130
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
3512035131
userA = wc_curve25519_new(HEAP_HINT, devId, &ret);
3512135132
if (ret != 0)
@@ -35132,14 +35143,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t curve25519_test(void)
3513235143
wc_curve25519_init_ex(pubKey, HEAP_HINT, devId);
3513335144
#endif
3513435145

35135-
#ifndef HAVE_FIPS
35136-
ret = wc_InitRng_ex(&rng, HEAP_HINT, devId);
35137-
#else
35138-
ret = wc_InitRng(&rng);
35139-
#endif
35140-
if (ret != 0)
35141-
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), cleanup);
35142-
3514335146
/* make curve25519 keys */
3514435147
ret = wc_curve25519_make_key(&rng, 32, userA);
3514535148
if (ret != 0)

0 commit comments

Comments
 (0)