Skip to content

Commit 7d2a2c7

Browse files
committed
Fix openssl memory leaks
Some leaks that snuck in during refactorings.
1 parent 607be65 commit 7d2a2c7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/openssl/openssl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3440,7 +3440,9 @@ PHP_FUNCTION(openssl_csr_get_public_key)
34403440
}
34413441

34423442
/* Retrieve the public key from the CSR */
3443-
EVP_PKEY *tpubkey = php_openssl_extract_public_key(X509_REQ_get_pubkey(csr));
3443+
EVP_PKEY *orig_key = X509_REQ_get_pubkey(csr);
3444+
EVP_PKEY *tpubkey = php_openssl_extract_public_key(orig_key);
3445+
EVP_PKEY_free(orig_key);
34443446

34453447
if (csr_str) {
34463448
/* We need to free the original CSR if it was freshly created */
@@ -4305,6 +4307,7 @@ static bool php_openssl_pkey_init_legacy_ec(EC_KEY *eckey, zval *data, bool *is_
43054307
php_openssl_store_errors();
43064308
}
43074309
if (EC_KEY_check_key(eckey)) {
4310+
EC_GROUP_free(group);
43084311
return true;
43094312
} else {
43104313
php_openssl_store_errors();

0 commit comments

Comments
 (0)