Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a memory leak in test_rcl_lifecycle. #1173

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rcl_lifecycle/test/test_rcl_lifecycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ TEST(TestRclLifecycle, state_machine) {
EXPECT_EQ(RCL_RET_INVALID_ARGUMENT, rcl_lifecycle_state_machine_is_initialized(&state_machine));
rcutils_reset_error();

void * temp_function = state_machine.com_interface.srv_change_state.impl;
state_machine.com_interface.srv_change_state.impl = nullptr;
// get_state service is valid, but not change_state service
EXPECT_EQ(RCL_RET_INVALID_ARGUMENT, rcl_lifecycle_state_machine_is_initialized(&state_machine));
Expand All @@ -357,10 +358,9 @@ TEST(TestRclLifecycle, state_machine) {
EXPECT_EQ(RCL_RET_INVALID_ARGUMENT, rcl_lifecycle_state_machine_is_initialized(&state_machine));

// get_state service is valid, but not change_state service
void * temp_function = state_machine.com_interface.srv_change_state.impl;
state_machine.com_interface.srv_change_state.impl = nullptr;
EXPECT_EQ(RCL_RET_INVALID_ARGUMENT, rcl_lifecycle_state_machine_is_initialized(&state_machine));
rcutils_reset_error();

state_machine.com_interface.srv_change_state.impl =
reinterpret_cast<rcl_service_impl_t *>(temp_function);

Expand Down