mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-17 16:51:33 -04:00
Use new[] and delete[] instead of malloc/free
This commit is contained in:
parent
e74528efdc
commit
fde72d7021
@ -68,7 +68,7 @@ public:
|
||||
|
||||
explicit unique_heap_array(T* a, size_type s) : array(a), _size(s) {}
|
||||
explicit unique_heap_array(size_type s) : _size(s) {
|
||||
array = reinterpret_cast<T*>(k_malloc(sizeof(T) * s));
|
||||
array = new T[s];
|
||||
}
|
||||
|
||||
unique_heap_array(unique_heap_array&& u) : array(u.release()), _size(u._size) {
|
||||
@ -111,7 +111,7 @@ public:
|
||||
|
||||
void reset(pointer_type p = pointer_type()){
|
||||
if(array!= p){
|
||||
k_free(reinterpret_cast<uint64_t*>(array));
|
||||
delete[] array;
|
||||
array= nullptr;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user