diff --git a/src/Image.cc b/src/Image.cc index 74ed14fb6..a2ad9cc43 100644 --- a/src/Image.cc +++ b/src/Image.cc @@ -19,6 +19,16 @@ using namespace ignition; using namespace rendering; +////////////////////////////////////////////////// +template <class T> +struct ArrayDeleter +{ + void operator () (T const * p) + { + delete [] p; + } +}; + ////////////////////////////////////////////////// Image::Image(unsigned int _width, unsigned int _height, PixelFormat _format) : @@ -27,7 +37,7 @@ Image::Image(unsigned int _width, unsigned int _height, { this->format = PixelUtil::Sanitize(_format); unsigned int size = this->MemorySize(); - this->data = DataPtr(new unsigned char[size]); + this->data = DataPtr(new unsigned char[size], ArrayDeleter<unsigned char>()); } //////////////////////////////////////////////////