Skip to content

Commit

Permalink
More PR comment fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Andras Fekete committed Aug 7, 2024
1 parent a31d8c5 commit 38d191c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions wolfcrypt/src/dilithium.c
Original file line number Diff line number Diff line change
Expand Up @@ -7934,8 +7934,10 @@ int wc_dilithium_check_key(dilithium_key* key)
}
}

/* Dispose of allocated memory. */
XFREE(s1, key->heap, DYNAMIC_TYPE_DILITHIUM);
if (key != NULL) {
/* Dispose of allocated memory. */
XFREE(s1, key->heap, DYNAMIC_TYPE_DILITHIUM);
}
#else
/* Validate parameter. */
if (key == NULL) {
Expand Down
12 changes: 7 additions & 5 deletions wolfcrypt/src/rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -5081,11 +5081,13 @@ int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng)

#if !defined(WOLFSSL_CRYPTOCELL) && !defined(WOLFSSL_SE050)
#ifdef WOLFSSL_SMALL_STACK
XFREE(p, key->heap, DYNAMIC_TYPE_RSA);
XFREE(q, key->heap, DYNAMIC_TYPE_RSA);
XFREE(tmp1, key->heap, DYNAMIC_TYPE_RSA);
XFREE(tmp2, key->heap, DYNAMIC_TYPE_RSA);
XFREE(tmp3, key->heap, DYNAMIC_TYPE_RSA);
if (key != NULL) {
XFREE(p, key->heap, DYNAMIC_TYPE_RSA);
XFREE(q, key->heap, DYNAMIC_TYPE_RSA);
XFREE(tmp1, key->heap, DYNAMIC_TYPE_RSA);
XFREE(tmp2, key->heap, DYNAMIC_TYPE_RSA);
XFREE(tmp3, key->heap, DYNAMIC_TYPE_RSA);
}
#elif defined(WOLFSSL_CHECK_MEM_ZERO)
mp_memzero_check(p);
mp_memzero_check(q);
Expand Down

0 comments on commit 38d191c

Please sign in to comment.