From df035d523734cc392d131fa9103126dffa5caaff Mon Sep 17 00:00:00 2001 From: David Williams Date: Thu, 8 Sep 2011 21:29:23 +0100 Subject: [PATCH] Fixed memory leaks. --- library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl | 1 + library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h | 1 + library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl | 2 +- .../PolyVoxCore/include/PolyVoxCore/SimpleVolumeBlock.inl | 6 ++++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl index 75486746..721488e0 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl @@ -103,6 +103,7 @@ namespace PolyVox LargeVolume::~LargeVolume() { flushAll(); + delete[] m_pUncompressedBorderData; } //////////////////////////////////////////////////////////////////////////////// diff --git a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h index 6ddeedb5..0a45eb0b 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h +++ b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h @@ -49,6 +49,7 @@ namespace PolyVox { public: Block(uint16_t uSideLength = 0); + ~Block(); uint16_t getSideLength(void) const; VoxelType getVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos) const; diff --git a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl index ace3929e..21f960a9 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl @@ -71,7 +71,7 @@ namespace PolyVox SimpleVolume::~SimpleVolume() { delete[] m_pBlocks; - m_pBlocks = 0; + delete[] m_pUncompressedBorderData; } //////////////////////////////////////////////////////////////////////////////// diff --git a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeBlock.inl b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeBlock.inl index 9b2d0c85..03e8c687 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeBlock.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeBlock.inl @@ -35,6 +35,12 @@ namespace PolyVox } } + template + SimpleVolume::Block::~Block() + { + delete[] m_tUncompressedData; + } + template uint16_t SimpleVolume::Block::getSideLength(void) const {