Skip to content

Commit

Permalink
Fix memory leak in test_count_matched, fini subscription (ros2#469)
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 committed Feb 7, 2020
1 parent 4b9c0a3 commit 77ff98f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions rcl/test/rcl/test_count_matched.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@ TEST_F(CLASSNAME(TestCountFixture, RMW_IMPLEMENTATION), test_count_matched_funct

check_state(wait_set_ptr, nullptr, &sub, graph_guard_condition, -1, 0, 9);
check_state(wait_set_ptr, nullptr, &sub2, graph_guard_condition, -1, 0, 9);

ret = rcl_subscription_fini(&sub, this->node_ptr);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
rcl_reset_error();

ret = rcl_subscription_fini(&sub2, this->node_ptr);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
rcl_reset_error();
}

TEST_F(
Expand Down Expand Up @@ -241,6 +249,14 @@ TEST_F(
check_state(wait_set_ptr, &pub, &sub, graph_guard_condition, 0, 0, 9);
check_state(wait_set_ptr, &pub, &sub2, graph_guard_condition, 0, 0, 9);

ret = rcl_subscription_fini(&sub, this->node_ptr);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
rcl_reset_error();

ret = rcl_subscription_fini(&sub2, this->node_ptr);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
rcl_reset_error();

ret = rcl_publisher_fini(&pub, this->node_ptr);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
rcl_reset_error();
Expand Down

0 comments on commit 77ff98f

Please sign in to comment.