@@ -2090,7 +2090,7 @@ int SSLWrap<Base>::TLSExtStatusCallback(SSL* s, void* arg) {
2090
2090
size_t len = Buffer::Length (obj);
2091
2091
2092
2092
// OpenSSL takes control of the pointer after accepting it
2093
- char * data = reinterpret_cast <char *>(malloc (len));
2093
+ char * data = reinterpret_cast <char *>(node::Malloc (len));
2094
2094
CHECK_NE (data, nullptr );
2095
2095
memcpy (data, resp, len);
2096
2096
@@ -3139,7 +3139,7 @@ bool CipherBase::GetAuthTag(char** out, unsigned int* out_len) const {
3139
3139
if (initialised_ || kind_ != kCipher || !auth_tag_)
3140
3140
return false ;
3141
3141
*out_len = auth_tag_len_;
3142
- *out = static_cast <char *>(malloc (auth_tag_len_));
3142
+ *out = static_cast <char *>(node::Malloc (auth_tag_len_));
3143
3143
CHECK_NE (*out, nullptr );
3144
3144
memcpy (*out, auth_tag_, auth_tag_len_);
3145
3145
return true ;
@@ -4694,7 +4694,7 @@ void ECDH::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
4694
4694
// NOTE: field_size is in bits
4695
4695
int field_size = EC_GROUP_get_degree (ecdh->group_ );
4696
4696
size_t out_len = (field_size + 7 ) / 8 ;
4697
- char * out = static_cast <char *>(malloc (out_len));
4697
+ char * out = static_cast <char *>(node::Malloc (out_len));
4698
4698
CHECK_NE (out, nullptr );
4699
4699
4700
4700
int r = ECDH_compute_key (out, out_len, pub, ecdh->key_ , nullptr );
@@ -4733,7 +4733,7 @@ void ECDH::GetPublicKey(const FunctionCallbackInfo<Value>& args) {
4733
4733
if (size == 0 )
4734
4734
return env->ThrowError (" Failed to get public key length" );
4735
4735
4736
- unsigned char * out = static_cast <unsigned char *>(malloc (size));
4736
+ unsigned char * out = static_cast <unsigned char *>(node::Malloc (size));
4737
4737
CHECK_NE (out, nullptr );
4738
4738
4739
4739
int r = EC_POINT_point2oct (ecdh->group_ , pub, form, out, size, nullptr );
@@ -4762,7 +4762,7 @@ void ECDH::GetPrivateKey(const FunctionCallbackInfo<Value>& args) {
4762
4762
return env->ThrowError (" Failed to get ECDH private key" );
4763
4763
4764
4764
int size = BN_num_bytes (b);
4765
- unsigned char * out = static_cast <unsigned char *>(malloc (size));
4765
+ unsigned char * out = static_cast <unsigned char *>(node::Malloc (size));
4766
4766
CHECK_NE (out, nullptr );
4767
4767
4768
4768
if (size != BN_bn2bin (b, out)) {
@@ -4839,7 +4839,7 @@ class PBKDF2Request : public AsyncWrap {
4839
4839
saltlen_(saltlen),
4840
4840
salt_(salt),
4841
4841
keylen_(keylen),
4842
- key_(static_cast <char *>(malloc (keylen))),
4842
+ key_(static_cast <char *>(node::Malloc (keylen))),
4843
4843
iter_(iter) {
4844
4844
if (key () == nullptr )
4845
4845
FatalError (" node::PBKDF2Request()" , " Out of Memory" );
@@ -5002,7 +5002,7 @@ void PBKDF2(const FunctionCallbackInfo<Value>& args) {
5002
5002
5003
5003
THROW_AND_RETURN_IF_NOT_BUFFER (args[1 ]);
5004
5004
5005
- pass = static_cast <char *>(malloc (passlen));
5005
+ pass = static_cast <char *>(node::Malloc (passlen));
5006
5006
if (pass == nullptr ) {
5007
5007
FatalError (" node::PBKDF2()" , " Out of Memory" );
5008
5008
}
@@ -5014,7 +5014,7 @@ void PBKDF2(const FunctionCallbackInfo<Value>& args) {
5014
5014
goto err;
5015
5015
}
5016
5016
5017
- salt = static_cast <char *>(malloc (saltlen));
5017
+ salt = static_cast <char *>(node::Malloc (saltlen));
5018
5018
if (salt == nullptr ) {
5019
5019
FatalError (" node::PBKDF2()" , " Out of Memory" );
5020
5020
}
@@ -5107,7 +5107,7 @@ class RandomBytesRequest : public AsyncWrap {
5107
5107
: AsyncWrap(env, object, AsyncWrap::PROVIDER_CRYPTO),
5108
5108
error_ (0 ),
5109
5109
size_(size),
5110
- data_(static_cast <char *>(malloc (size))) {
5110
+ data_(static_cast <char *>(node::Malloc (size))) {
5111
5111
if (data () == nullptr )
5112
5112
FatalError (" node::RandomBytesRequest()" , " Out of Memory" );
5113
5113
Wrap (object, this );
@@ -5336,7 +5336,7 @@ void GetCurves(const FunctionCallbackInfo<Value>& args) {
5336
5336
5337
5337
if (num_curves) {
5338
5338
alloc_size = sizeof (*curves) * num_curves;
5339
- curves = static_cast <EC_builtin_curve*>(malloc (alloc_size));
5339
+ curves = static_cast <EC_builtin_curve*>(node::Malloc (alloc_size));
5340
5340
5341
5341
CHECK_NE (curves, nullptr );
5342
5342
0 commit comments