diff --git a/rcl/test/rcl/test_publisher.cpp b/rcl/test/rcl/test_publisher.cpp index c536f9242..3fcbe0227 100644 --- a/rcl/test/rcl/test_publisher.cpp +++ b/rcl/test/rcl/test_publisher.cpp @@ -603,6 +603,9 @@ TEST_F( OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT( { test_msgs__msg__Strings__fini(&msg); + ASSERT_EQ( + RMW_RET_OK, + rmw_serialized_message_fini(&serialized_msg)) << rcl_get_error_string().str; }); ASSERT_TRUE(rosidl_runtime_c__String__assign(&msg.string_value, test_string)); diff --git a/rcl/test/rcl/test_subscription.cpp b/rcl/test/rcl/test_subscription.cpp index 471a3110a..2d0e4b635 100644 --- a/rcl/test/rcl/test_subscription.cpp +++ b/rcl/test/rcl/test_subscription.cpp @@ -571,6 +571,11 @@ TEST_F(CLASSNAME(TestSubscriptionFixture, RMW_IMPLEMENTATION), test_subscription { ret = rcl_subscription_fini(&subscription, this->node_ptr); EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str; + + test_msgs__msg__Strings__fini(&msg); + ASSERT_EQ( + RMW_RET_OK, + rmw_serialized_message_fini(&serialized_msg)) << rcl_get_error_string().str; }); rcl_reset_error(); @@ -595,6 +600,11 @@ TEST_F(CLASSNAME(TestSubscriptionFixture, RMW_IMPLEMENTATION), test_subscription ASSERT_EQ(RMW_RET_OK, ret); ASSERT_EQ( std::string(test_string), std::string(msg_rcv.string_value.data, msg_rcv.string_value.size)); + + test_msgs__msg__Strings__fini(&msg_rcv); + ASSERT_EQ( + RMW_RET_OK, + rmw_serialized_message_fini(&serialized_msg_rcv)) << rcl_get_error_string().str; } }