From 9834911307323ad8a8068c1a674780ec229ab79d Mon Sep 17 00:00:00 2001 From: GoesM Date: Sun, 28 Jan 2024 04:24:07 +0800 Subject: [PATCH 1/2] free `map_sub_` before `map_free(map_)` Signed-off-by: GoesM --- nav2_amcl/src/amcl_node.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/nav2_amcl/src/amcl_node.cpp b/nav2_amcl/src/amcl_node.cpp index 19c40517ca..7924c4bb0b 100644 --- a/nav2_amcl/src/amcl_node.cpp +++ b/nav2_amcl/src/amcl_node.cpp @@ -333,6 +333,7 @@ AmclNode::on_cleanup(const rclcpp_lifecycle::State & /*state*/) laser_scan_sub_.reset(); // Map + map_sub_.reset(); // map_sub_ may access map_, so it should be reset earlier if (map_ != NULL) { map_free(map_); map_ = nullptr; From f591c8bb830668bd15631069b1e160c7989146aa Mon Sep 17 00:00:00 2001 From: GoesM Date: Sun, 28 Jan 2024 15:46:47 +0800 Subject: [PATCH 2/2] reformat Signed-off-by: GoesM --- nav2_amcl/src/amcl_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nav2_amcl/src/amcl_node.cpp b/nav2_amcl/src/amcl_node.cpp index 7924c4bb0b..192111439f 100644 --- a/nav2_amcl/src/amcl_node.cpp +++ b/nav2_amcl/src/amcl_node.cpp @@ -333,7 +333,7 @@ AmclNode::on_cleanup(const rclcpp_lifecycle::State & /*state*/) laser_scan_sub_.reset(); // Map - map_sub_.reset(); // map_sub_ may access map_, so it should be reset earlier + map_sub_.reset(); // map_sub_ may access map_, so it should be reset earlier if (map_ != NULL) { map_free(map_); map_ = nullptr;