Skip to content

Commit

Permalink
Merge pull request wolfSSL#8094 from JacobBarthelmeh/coverity
Browse files Browse the repository at this point in the history
minor fixes for Coverity reports
  • Loading branch information
douzzer authored Oct 23, 2024
2 parents beeda7b + f21a763 commit 6e14889
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/x509.c
Original file line number Diff line number Diff line change
Expand Up @@ -14121,7 +14121,9 @@ int wolfSSL_X509_check_ip_asc(WOLFSSL_X509 *x, const char *ipasc,
}

#ifdef WOLFSSL_SMALL_STACK
XFREE(dCert, x->heap, DYNAMIC_TYPE_DCERT);
if (x != NULL) {
XFREE(dCert, x->heap, DYNAMIC_TYPE_DCERT);
}
#endif

return ret;
Expand Down
19 changes: 11 additions & 8 deletions wolfcrypt/test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -13939,6 +13939,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_cbc_test(void)
if ((bigCipher == NULL) ||
(bigPlain == NULL)) {
XFREE(bigCipher, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
XFREE(bigPlain, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
}
#else
Expand Down Expand Up @@ -35116,6 +35117,16 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t curve25519_test(void)
(void)x;
WOLFSSL_ENTER("curve25519_test");

/* wc_FreeRng is always called on exit. Therefore wc_InitRng should be
* called before any exit goto's */
#ifndef HAVE_FIPS
ret = wc_InitRng_ex(&rng, HEAP_HINT, devId);
#else
ret = wc_InitRng(&rng);
#endif
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);

#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
userA = wc_curve25519_new(HEAP_HINT, devId, &ret);
if (ret != 0)
Expand All @@ -35132,14 +35143,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t curve25519_test(void)
wc_curve25519_init_ex(pubKey, HEAP_HINT, devId);
#endif

#ifndef HAVE_FIPS
ret = wc_InitRng_ex(&rng, HEAP_HINT, devId);
#else
ret = wc_InitRng(&rng);
#endif
if (ret != 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), cleanup);

/* make curve25519 keys */
ret = wc_curve25519_make_key(&rng, 32, userA);
if (ret != 0)
Expand Down

0 comments on commit 6e14889

Please sign in to comment.