Skip to content

Commit

Permalink
Finalize rcl_handle to prevent leak (#1528) (#1529)
Browse files Browse the repository at this point in the history
Signed-off-by: y-okumura-isp <y-okumura@isp.co.jp>
  • Loading branch information
y-okumura-isp authored and Karsten1987 committed Mar 2, 2021
1 parent c191820 commit 02355f0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion rclcpp_action/test/test_server_goal_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,16 @@ class TestServerGoalHandle : public ::testing::Test
void SetUp()
{
std::shared_ptr<rcl_action_goal_handle_t> rcl_handle =
std::make_shared<rcl_action_goal_handle_t>();
std::shared_ptr<rcl_action_goal_handle_t>(
new rcl_action_goal_handle_t,
[](rcl_action_goal_handle_t * p) {
if (nullptr == p) {
return;
}
rcl_ret_t ret = rcl_action_goal_handle_fini(p);
EXPECT_EQ(ret, RCL_RET_OK) << rcl_get_error_string().str;
delete p;
});
*rcl_handle.get() = rcl_action_get_zero_initialized_goal_handle();
rcutils_allocator_t allocator = rcutils_get_default_allocator();
rcl_action_goal_info_t goal_info = rcl_action_get_zero_initialized_goal_info();
Expand Down

0 comments on commit 02355f0

Please sign in to comment.