From fde72d70211b9696ebe93331e5479a6dfde8c5a7 Mon Sep 17 00:00:00 2001 From: Baptiste Wicht Date: Fri, 8 Nov 2013 18:09:24 +0100 Subject: [PATCH] Use new[] and delete[] instead of malloc/free --- kernel/include/array.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/include/array.hpp b/kernel/include/array.hpp index 31774295..89fe1c1d 100644 --- a/kernel/include/array.hpp +++ b/kernel/include/array.hpp @@ -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(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(array)); + delete[] array; array= nullptr; } }