Skip to content

Commit

Permalink
memory freeing
Browse files Browse the repository at this point in the history
  • Loading branch information
jakemas committed Feb 20, 2025
1 parent 2132f7f commit 09bd679
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crypto/fipsmodule/pqdsa/pqdsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,18 @@ int PQDSA_KEY_set_raw_keypair_from_seed(PQDSA_KEY *key, CBS *in) {

uint8_t *seed = OPENSSL_malloc(key->pqdsa->keygen_seed_len);
if (seed == NULL) {
OPENSSL_free(seed);
OPENSSL_free(private_key);
OPENSSL_free(public_key);
return 0;
}

// attempt to generate the key from the provided seed
if (!key->pqdsa->method->pqdsa_keygen_internal(public_key,
private_key,
CBS_data(in))) {
OPENSSL_free(public_key);
OPENSSL_free(private_key);
OPENSSL_free(seed);
OPENSSL_PUT_ERROR(EVP, EVP_R_DECODE_ERROR);
return 0;
}
Expand Down

0 comments on commit 09bd679

Please sign in to comment.