diff --git a/deps/ncrypto/ncrypto.cc b/deps/ncrypto/ncrypto.cc index 461819ce0fa732..3a26cfbdcab52e 100644 --- a/deps/ncrypto/ncrypto.cc +++ b/deps/ncrypto/ncrypto.cc @@ -1470,6 +1470,7 @@ BIOPointer BIOPointer::NewSecMem() { } BIOPointer BIOPointer::New(const BIO_METHOD* method) { + if (method == nullptr) return {}; return BIOPointer(BIO_new(method)); } diff --git a/src/crypto/crypto_bio.cc b/src/crypto/crypto_bio.cc index f32cb1cff7d41d..cdf87c322afd9c 100644 --- a/src/crypto/crypto_bio.cc +++ b/src/crypto/crypto_bio.cc @@ -226,6 +226,7 @@ const BIO_METHOD* NodeBIO::GetMethod() { // Static initialization ensures that this is safe to use concurrently. static const BIO_METHOD* method = [&]() { BIO_METHOD* method = BIO_meth_new(BIO_TYPE_MEM, "node.js SSL buffer"); + CHECK_NOT_NULL(method); BIO_meth_set_write(method, Write); BIO_meth_set_read(method, Read); BIO_meth_set_puts(method, Puts);