diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-21 14:43:15 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-21 15:07:32 +0200 |
commit | c939a67866536247325b204929d8b9cac021c71e (patch) | |
tree | 8b3d14a1293d93a6d86f7b498b340bec973cf7d2 | |
parent | dfe6f0c1c6838d1fd9e6be49fd6896d421b4dac8 (diff) | |
download | php-git-c939a67866536247325b204929d8b9cac021c71e.tar.gz |
Fix d leak in ecc openssl_pkey_new
-rw-r--r-- | ext/openssl/openssl.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 69120f3559..c1560fa884 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -4370,7 +4370,7 @@ PHP_FUNCTION(openssl_pkey_new) EC_KEY *eckey = NULL; EC_GROUP *group = NULL; EC_POINT *pnt = NULL; - const BIGNUM *d; + BIGNUM *d = NULL; pkey = EVP_PKEY_new(); if (pkey) { eckey = EC_KEY_new(); @@ -4418,6 +4418,8 @@ PHP_FUNCTION(openssl_pkey_new) php_openssl_store_errors(); goto clean_exit; } + + BN_free(d); } else if ((x = zend_hash_str_find(Z_ARRVAL_P(data), "x", sizeof("x") - 1)) != NULL && Z_TYPE_P(x) == IS_STRING && (y = zend_hash_str_find(Z_ARRVAL_P(data), "y", sizeof("y") - 1)) != NULL && @@ -4462,6 +4464,9 @@ PHP_FUNCTION(openssl_pkey_new) php_openssl_store_errors(); } clean_exit: + if (d != NULL) { + BN_free(d); + } if (pnt != NULL) { EC_POINT_free(pnt); } |