Skip to content

Commit 78f2efd

Browse files
committed
Use new
1 parent 4e5ffcc commit 78f2efd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libraries/Update/src/Updater.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,10 @@ bool UpdateClass::setCryptKey(const uint8_t *cryptKey){
207207
}
208208
//initialize
209209
if(!_cryptKey){
210-
_cryptKey = (uint8_t*)malloc(ENCRYPTED_KEY_SIZE);
210+
_cryptKey = new (std::nothrow) uint8_t[ENCRYPTED_KEY_SIZE];
211211
}
212212
if(!_cryptKey){
213-
log_e("malloc failed");
213+
log_e("new failed");
214214
return false;
215215
}
216216
memcpy(_cryptKey, cryptKey, ENCRYPTED_KEY_SIZE);
@@ -303,10 +303,10 @@ bool UpdateClass::_decryptBuffer(){
303303
return false;
304304
}
305305
if(!_cryptBuffer){
306-
_cryptBuffer = (uint8_t*)malloc(ENCRYPTED_BLOCK_SIZE);
306+
_cryptBuffer = new (std::nothrow) uint8_t[ENCRYPTED_BLOCK_SIZE];
307307
}
308308
if(!_cryptBuffer){
309-
log_e("malloc failed");
309+
log_e("new failed");
310310
return false;
311311
}
312312
uint8_t tweaked_key[ENCRYPTED_KEY_SIZE]; //tweaked crypt key

0 commit comments

Comments
 (0)