Skip to content

Commit f532a44

Browse files
committed
Fix memory leak in test_count_matched, fini subscription (#469)
Signed-off-by: y-okumura-isp <[email protected]>
1 parent 7537f83 commit f532a44

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

rcl/test/rcl/test_count_matched.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,14 @@ TEST_F(CLASSNAME(TestCountFixture, RMW_IMPLEMENTATION), test_count_matched_funct
185185

186186
check_state(wait_set_ptr, nullptr, &sub, graph_guard_condition, -1, 0, 9);
187187
check_state(wait_set_ptr, nullptr, &sub2, graph_guard_condition, -1, 0, 9);
188+
189+
ret = rcl_subscription_fini(&sub, this->node_ptr);
190+
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
191+
rcl_reset_error();
192+
193+
ret = rcl_subscription_fini(&sub2, this->node_ptr);
194+
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
195+
rcl_reset_error();
188196
}
189197

190198
TEST_F(CLASSNAME(TestCountFixture, RMW_IMPLEMENTATION),
@@ -239,6 +247,14 @@ TEST_F(CLASSNAME(TestCountFixture, RMW_IMPLEMENTATION),
239247
check_state(wait_set_ptr, &pub, &sub, graph_guard_condition, 0, 0, 9);
240248
check_state(wait_set_ptr, &pub, &sub2, graph_guard_condition, 0, 0, 9);
241249

250+
ret = rcl_subscription_fini(&sub, this->node_ptr);
251+
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
252+
rcl_reset_error();
253+
254+
ret = rcl_subscription_fini(&sub2, this->node_ptr);
255+
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
256+
rcl_reset_error();
257+
242258
ret = rcl_publisher_fini(&pub, this->node_ptr);
243259
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
244260
rcl_reset_error();

0 commit comments

Comments
 (0)