@@ -2279,7 +2279,7 @@ int SSLWrap<Base>::TLSExtStatusCallback(SSL* s, void* arg) {
22792279 size_t len = Buffer::Length (obj);
22802280
22812281 // OpenSSL takes control of the pointer after accepting it
2282- char * data = reinterpret_cast <char *>(malloc (len));
2282+ char * data = reinterpret_cast <char *>(node::Malloc (len));
22832283 CHECK_NE (data, nullptr );
22842284 memcpy (data, resp, len);
22852285
@@ -3330,7 +3330,7 @@ bool CipherBase::GetAuthTag(char** out, unsigned int* out_len) const {
33303330 if (initialised_ || kind_ != kCipher || !auth_tag_)
33313331 return false ;
33323332 *out_len = auth_tag_len_;
3333- *out = static_cast <char *>(malloc (auth_tag_len_));
3333+ *out = static_cast <char *>(node::Malloc (auth_tag_len_));
33343334 CHECK_NE (*out, nullptr );
33353335 memcpy (*out, auth_tag_, auth_tag_len_);
33363336 return true ;
@@ -4906,7 +4906,7 @@ void ECDH::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
49064906 // NOTE: field_size is in bits
49074907 int field_size = EC_GROUP_get_degree (ecdh->group_ );
49084908 size_t out_len = (field_size + 7 ) / 8 ;
4909- char * out = static_cast <char *>(malloc (out_len));
4909+ char * out = static_cast <char *>(node::Malloc (out_len));
49104910 CHECK_NE (out, nullptr );
49114911
49124912 int r = ECDH_compute_key (out, out_len, pub, ecdh->key_ , nullptr );
@@ -4942,7 +4942,7 @@ void ECDH::GetPublicKey(const FunctionCallbackInfo<Value>& args) {
49424942 if (size == 0 )
49434943 return env->ThrowError (" Failed to get public key length" );
49444944
4945- unsigned char * out = static_cast <unsigned char *>(malloc (size));
4945+ unsigned char * out = static_cast <unsigned char *>(node::Malloc (size));
49464946 CHECK_NE (out, nullptr );
49474947
49484948 int r = EC_POINT_point2oct (ecdh->group_ , pub, form, out, size, nullptr );
@@ -4968,7 +4968,7 @@ void ECDH::GetPrivateKey(const FunctionCallbackInfo<Value>& args) {
49684968 return env->ThrowError (" Failed to get ECDH private key" );
49694969
49704970 int size = BN_num_bytes (b);
4971- unsigned char * out = static_cast <unsigned char *>(malloc (size));
4971+ unsigned char * out = static_cast <unsigned char *>(node::Malloc (size));
49724972 CHECK_NE (out, nullptr );
49734973
49744974 if (size != BN_bn2bin (b, out)) {
@@ -5099,7 +5099,7 @@ class PBKDF2Request : public AsyncWrap {
50995099 saltlen_(saltlen),
51005100 salt_(salt),
51015101 keylen_(keylen),
5102- key_(static_cast <char *>(malloc (keylen))),
5102+ key_(static_cast <char *>(node::Malloc (keylen))),
51035103 iter_(iter) {
51045104 if (key () == nullptr )
51055105 FatalError (" node::PBKDF2Request()" , " Out of Memory" );
@@ -5262,7 +5262,7 @@ void PBKDF2(const FunctionCallbackInfo<Value>& args) {
52625262
52635263 THROW_AND_RETURN_IF_NOT_BUFFER (args[1 ], " Salt" );
52645264
5265- pass = static_cast <char *>(malloc (passlen));
5265+ pass = static_cast <char *>(node::Malloc (passlen));
52665266 if (pass == nullptr ) {
52675267 FatalError (" node::PBKDF2()" , " Out of Memory" );
52685268 }
@@ -5274,7 +5274,7 @@ void PBKDF2(const FunctionCallbackInfo<Value>& args) {
52745274 goto err;
52755275 }
52765276
5277- salt = static_cast <char *>(malloc (saltlen));
5277+ salt = static_cast <char *>(node::Malloc (saltlen));
52785278 if (salt == nullptr ) {
52795279 FatalError (" node::PBKDF2()" , " Out of Memory" );
52805280 }
@@ -5367,7 +5367,7 @@ class RandomBytesRequest : public AsyncWrap {
53675367 : AsyncWrap(env, object, AsyncWrap::PROVIDER_CRYPTO),
53685368 error_ (0 ),
53695369 size_(size),
5370- data_(static_cast <char *>(malloc (size))) {
5370+ data_(static_cast <char *>(node::Malloc (size))) {
53715371 if (data () == nullptr )
53725372 FatalError (" node::RandomBytesRequest()" , " Out of Memory" );
53735373 Wrap (object, this );
@@ -5596,7 +5596,7 @@ void GetCurves(const FunctionCallbackInfo<Value>& args) {
55965596
55975597 if (num_curves) {
55985598 alloc_size = sizeof (*curves) * num_curves;
5599- curves = static_cast <EC_builtin_curve*>(malloc (alloc_size));
5599+ curves = static_cast <EC_builtin_curve*>(node::Malloc (alloc_size));
56005600
56015601 CHECK_NE (curves, nullptr );
56025602
0 commit comments