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)

Signed-off-by: Tomoya.Fujita <Tomoya.Fujita@sony.com>
  • Loading branch information
fujitatomoya authored and Karsten1987 committed Mar 2, 2021
1 parent bb0dc35 commit a759808
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 @@ -102,8 +102,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 a759808

Please sign in to comment.