Fixed huge memory leak reading textures

This commit is contained in:
2015-10-15 17:54:42 +02:00
parent 4a031147a6
commit f732687347
2 changed files with 12 additions and 10 deletions
+4 -2
View File
@@ -97,6 +97,7 @@ dd::PNG::PNG(std::string path)
// Read in the data
png_read_image(png_ptr, row_pointers);
delete[] row_pointers;
this->Width = width;
this->Height = height;
@@ -107,8 +108,9 @@ dd::PNG::PNG(std::string path)
dd::PNG::~PNG()
{
if (Data) {
delete[] Data;
if (this->Data != nullptr) {
delete[] this->Data;
this->Data = nullptr;
}
}