From 778d3715cee8b6e2335f2dd4c67856e63502ebd4 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 30 Apr 2013 10:37:02 -0700 Subject: [PATCH] cr cleanup --- libraries/voxels/src/VoxelNodeBag.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/voxels/src/VoxelNodeBag.cpp b/libraries/voxels/src/VoxelNodeBag.cpp index 63fcc97349..e6b20cbf4b 100644 --- a/libraries/voxels/src/VoxelNodeBag.cpp +++ b/libraries/voxels/src/VoxelNodeBag.cpp @@ -61,12 +61,13 @@ void VoxelNodeBag::insert(VoxelNode* node) { // copy old elements into the new bag, but leave a space where we need to // insert the new node memcpy(_bagElements, oldBag, insertAt * sizeof(VoxelNode*)); - memcpy(&_bagElements[insertAt+1], &oldBag[insertAt], (_elementsInUse-insertAt) * sizeof(VoxelNode*)); + memcpy(&_bagElements[insertAt + 1], &oldBag[insertAt], (_elementsInUse - insertAt) * sizeof(VoxelNode*)); + delete[] oldBag; } } else { // move existing elements further back in the bag array, leave a space where we need to // insert the new node - memmove(&_bagElements[insertAt+1], &_bagElements[insertAt], (_elementsInUse-insertAt) * sizeof(VoxelNode*)); + memmove(&_bagElements[insertAt + 1], &_bagElements[insertAt], (_elementsInUse - insertAt) * sizeof(VoxelNode*)); } _bagElements[insertAt] = node; _elementsInUse++;