Fix allocation size vector

This commit is contained in:
2019-04-29 17:48:35 +02:00
parent 2c726f144f
commit c04e639a15

View File

@@ -1,4 +1,3 @@
#include <cstddef>
#include <cstdlib> #include <cstdlib>
#include <stdexcept> #include <stdexcept>
@@ -12,7 +11,7 @@ protected:
public: public:
void Resize(std::size_t const newSize) void Resize(std::size_t const newSize)
{ {
void * result = std::realloc(data, newSize); void * result = std::realloc(data, newSize * sizeof(T));
if(result == nullptr) if(result == nullptr)
{ {
throw std::runtime_error("Cannot allocate the requested size of memory."); throw std::runtime_error("Cannot allocate the requested size of memory.");