From 5a3f34a77a7f8d2b7d72b9b31596c578775af123 Mon Sep 17 00:00:00 2001 From: xinyiz Date: Mon, 23 Mar 2020 11:13:48 -0700 Subject: [PATCH 1/2] Fix children[] array not deleted in deleteNodeRecurs function. --- octomap/include/octomap/OcTreeBaseImpl.hxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/octomap/include/octomap/OcTreeBaseImpl.hxx b/octomap/include/octomap/OcTreeBaseImpl.hxx index dd7c2b21..c48ed475 100644 --- a/octomap/include/octomap/OcTreeBaseImpl.hxx +++ b/octomap/include/octomap/OcTreeBaseImpl.hxx @@ -706,6 +706,10 @@ namespace octomap { this->deleteNodeChild(node, pos); if (!nodeHasChildren(node)) + if(node->children != NULL){ + delete[] node->children; + node->children = NULL; + } return true; else{ node->updateOccupancyChildren(); // TODO: occupancy? From c210dad3c4620dfacc2cb883bffe1f70e69f36ed Mon Sep 17 00:00:00 2001 From: xinyiz Date: Mon, 23 Mar 2020 11:13:48 -0700 Subject: [PATCH 2/2] Fix children[] array not deleted in deleteNodeRecurs function. --- octomap/include/octomap/OcTreeBaseImpl.hxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/octomap/include/octomap/OcTreeBaseImpl.hxx b/octomap/include/octomap/OcTreeBaseImpl.hxx index dd7c2b21..c48ed475 100644 --- a/octomap/include/octomap/OcTreeBaseImpl.hxx +++ b/octomap/include/octomap/OcTreeBaseImpl.hxx @@ -706,6 +706,10 @@ namespace octomap { this->deleteNodeChild(node, pos); if (!nodeHasChildren(node)) + if(node->children != NULL){ + delete[] node->children; + node->children = NULL; + } return true; else{ node->updateOccupancyChildren(); // TODO: occupancy?