Skip to content

Commit

Permalink
node_handle must be destroyed after client_handle to prevent memory l…
Browse files Browse the repository at this point in the history
…eak (#1562) (#1565)

Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
  • Loading branch information
fujitatomoya authored Feb 27, 2021
1 parent 8f2809d commit 47f21da
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rclcpp_action/src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ class ClientBaseImpl

rclcpp::Context::SharedPtr context_;
rclcpp::node_interfaces::NodeGraphInterface::WeakPtr node_graph_;
std::shared_ptr<rcl_action_client_t> client_handle{nullptr};
// node_handle must be destroyed after client_handle to prevent memory leak
std::shared_ptr<rcl_node_t> node_handle{nullptr};
std::shared_ptr<rcl_action_client_t> client_handle{nullptr};
rclcpp::Logger logger;

using ResponseCallback = std::function<void (std::shared_ptr<void> response)>;
Expand Down

0 comments on commit 47f21da

Please sign in to comment.