|
@@ -112,7 +112,7 @@ public:
|
|
clear_storage();
|
|
clear_storage();
|
|
|
|
|
|
size_t size = height * width;
|
|
size_t size = height * width;
|
|
- auto* new_storage = static_cast<T*>(malloc(size * sizeof(T)));
|
|
|
|
|
|
+ auto* new_storage = new (nothrow) T[size];
|
|
if (!new_storage)
|
|
if (!new_storage)
|
|
return Error::from_errno(ENOMEM);
|
|
return Error::from_errno(ENOMEM);
|
|
m_storage = new_storage;
|
|
m_storage = new_storage;
|
|
@@ -194,8 +194,7 @@ public:
|
|
private:
|
|
private:
|
|
void clear_storage()
|
|
void clear_storage()
|
|
{
|
|
{
|
|
- if (m_storage)
|
|
|
|
- free(m_storage);
|
|
|
|
|
|
+ delete[] m_storage;
|
|
m_storage = nullptr;
|
|
m_storage = nullptr;
|
|
m_width = 0;
|
|
m_width = 0;
|
|
m_height = 0;
|
|
m_height = 0;
|