tls: fix leak on invalid protocol method

PR-URL: https://github.com/nodejs/node/pull/60427
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Shelley Vohr
2025-11-03 17:35:56 +01:00
committed by GitHub
parent 21b0fe4b28
commit e40b9b98bb

View File

@@ -1351,7 +1351,6 @@ SecureContext* SecureContext::Create(Environment* env) {
SecureContext::SecureContext(Environment* env, Local<Object> wrap)
: BaseObject(env, wrap) {
MakeWeak();
env->external_memory_accounter()->Increase(env->isolate(), kExternalSize);
}
inline void SecureContext::Reset() {
@@ -1469,6 +1468,8 @@ void SecureContext::Init(const FunctionCallbackInfo<Value>& args) {
if (!sc->ctx_) {
return ThrowCryptoError(env, ERR_get_error(), "SSL_CTX_new");
}
env->external_memory_accounter()->Increase(env->isolate(), kExternalSize);
SSL_CTX_set_app_data(sc->ctx_.get(), sc);
// Disable SSLv2 in the case when method == TLS_method() and the