Skip to content

Commit 32149be

Browse files
ni4antonsviridenko
authored andcommitted
Fix possible memory leak during ElGamal key generation with OpenSSL 3.0 backend.
1 parent 12133aa commit 32149be

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib/crypto/elgamal_ossl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,10 @@ elgamal_generate(rnp::RNG *rng, pgp_eg_key_t *key, size_t keybits)
394394
goto done;
395395
}
396396
if (y.bytes() != BITS_TO_BYTES(keybits)) {
397+
EVP_PKEY_CTX_free(ctx);
398+
ctx = NULL;
399+
EVP_PKEY_free(pkey);
400+
pkey = NULL;
397401
goto start;
398402
}
399403

0 commit comments

Comments
 (0)