diff --git a/rmw_fastrtps_cpp/src/publisher.cpp b/rmw_fastrtps_cpp/src/publisher.cpp index 0ab4a609c..ccece0ffd 100644 --- a/rmw_fastrtps_cpp/src/publisher.cpp +++ b/rmw_fastrtps_cpp/src/publisher.cpp @@ -18,6 +18,8 @@ #include "fastrtps/Domain.h" #include "fastrtps/participant/Participant.h" +#include "rcutils/macros.h" + #include "rmw/allocators.h" #include "rmw/error_handling.h" #include "rmw/rmw.h" @@ -52,6 +54,8 @@ rmw_fastrtps_cpp::create_publisher( bool keyed, bool create_publisher_listener) { + RCUTILS_CAN_RETURN_WITH_ERROR_OF(nullptr); + RMW_CHECK_ARGUMENT_FOR_NULL(participant_info, nullptr); RMW_CHECK_ARGUMENT_FOR_NULL(type_supports, nullptr); RMW_CHECK_ARGUMENT_FOR_NULL(topic_name, nullptr); diff --git a/rmw_fastrtps_cpp/src/subscription.cpp b/rmw_fastrtps_cpp/src/subscription.cpp index c446c6534..6259bb5b8 100644 --- a/rmw_fastrtps_cpp/src/subscription.cpp +++ b/rmw_fastrtps_cpp/src/subscription.cpp @@ -16,6 +16,7 @@ #include #include "rcutils/allocator.h" +#include "rcutils/macros.h" #include "rcutils/strdup.h" #include "rmw/allocators.h" @@ -58,6 +59,8 @@ create_subscription( bool keyed, bool create_subscription_listener) { + RCUTILS_CAN_RETURN_WITH_ERROR_OF(nullptr); + RMW_CHECK_ARGUMENT_FOR_NULL(participant_info, nullptr); RMW_CHECK_ARGUMENT_FOR_NULL(type_supports, nullptr); RMW_CHECK_ARGUMENT_FOR_NULL(topic_name, nullptr); diff --git a/rmw_fastrtps_shared_cpp/src/participant.cpp b/rmw_fastrtps_shared_cpp/src/participant.cpp index 5498033e0..6f4a1d56b 100644 --- a/rmw_fastrtps_shared_cpp/src/participant.cpp +++ b/rmw_fastrtps_shared_cpp/src/participant.cpp @@ -144,6 +144,8 @@ rmw_fastrtps_shared_cpp::create_participant( const char * enclave, rmw_dds_common::Context * common_context) { + RCUTILS_CAN_RETURN_WITH_ERROR_OF(nullptr); + if (!security_options) { RMW_SET_ERROR_MSG("security_options is null"); return nullptr; @@ -261,7 +263,6 @@ rmw_fastrtps_shared_cpp::create_participant( rmw_ret_t rmw_fastrtps_shared_cpp::destroy_participant(CustomParticipantInfo * participant_info) { - rmw_ret_t result_ret = RMW_RET_OK; if (!participant_info) { RMW_SET_ERROR_MSG("participant_info is null"); return RMW_RET_ERROR; @@ -270,5 +271,7 @@ rmw_fastrtps_shared_cpp::destroy_participant(CustomParticipantInfo * participant delete participant_info->listener; participant_info->listener = nullptr; delete participant_info; - return result_ret; + + RCUTILS_CAN_RETURN_WITH_ERROR_OF(RMW_RET_ERROR); // on completion + return RMW_RET_OK; } diff --git a/rmw_fastrtps_shared_cpp/src/publisher.cpp b/rmw_fastrtps_shared_cpp/src/publisher.cpp index 03c6f5cb0..90eb10984 100644 --- a/rmw_fastrtps_shared_cpp/src/publisher.cpp +++ b/rmw_fastrtps_shared_cpp/src/publisher.cpp @@ -48,6 +48,7 @@ destroy_publisher( rmw_free(const_cast(publisher->topic_name)); rmw_publisher_free(publisher); + RCUTILS_CAN_RETURN_WITH_ERROR_OF(RMW_RET_ERROR); // on completion return RMW_RET_OK; } } // namespace rmw_fastrtps_shared_cpp diff --git a/rmw_fastrtps_shared_cpp/src/rmw_client.cpp b/rmw_fastrtps_shared_cpp/src/rmw_client.cpp index 25bb952c1..67f226bdc 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_client.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_client.cpp @@ -77,6 +77,7 @@ __rmw_destroy_client( rmw_free(const_cast(client->service_name)); rmw_client_free(client); + RCUTILS_CAN_RETURN_WITH_ERROR_OF(RMW_RET_ERROR); // on completion return ret; } } // namespace rmw_fastrtps_shared_cpp diff --git a/rmw_fastrtps_shared_cpp/src/rmw_guard_condition.cpp b/rmw_fastrtps_shared_cpp/src/rmw_guard_condition.cpp index 4dac80e26..cdcac523c 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_guard_condition.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_guard_condition.cpp @@ -24,6 +24,8 @@ namespace rmw_fastrtps_shared_cpp rmw_guard_condition_t * __rmw_create_guard_condition(const char * identifier) { + RCUTILS_CAN_RETURN_WITH_ERROR_OF(nullptr); + rmw_guard_condition_t * guard_condition_handle = new rmw_guard_condition_t; guard_condition_handle->implementation_identifier = identifier; guard_condition_handle->data = new GuardCondition(); @@ -33,12 +35,15 @@ __rmw_create_guard_condition(const char * identifier) rmw_ret_t __rmw_destroy_guard_condition(rmw_guard_condition_t * guard_condition) { + rmw_ret_t ret = RMW_RET_ERROR; + if (guard_condition) { delete static_cast(guard_condition->data); delete guard_condition; - return RMW_RET_OK; + ret = RMW_RET_OK; } - return RMW_RET_ERROR; + RCUTILS_CAN_RETURN_WITH_ERROR_OF(RMW_RET_ERROR); // on completion + return ret; } } // namespace rmw_fastrtps_shared_cpp diff --git a/rmw_fastrtps_shared_cpp/src/rmw_node.cpp b/rmw_fastrtps_shared_cpp/src/rmw_node.cpp index 7a3a4f915..2bda0b746 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_node.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_node.cpp @@ -150,6 +150,8 @@ __rmw_destroy_node( rmw_free(const_cast(node->name)); rmw_free(const_cast(node->namespace_)); rmw_node_free(node); + + RCUTILS_CAN_RETURN_WITH_ERROR_OF(RMW_RET_ERROR); // on completion return RMW_RET_OK; } diff --git a/rmw_fastrtps_shared_cpp/src/rmw_service.cpp b/rmw_fastrtps_shared_cpp/src/rmw_service.cpp index 9c7cbc4af..df5b47133 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_service.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_service.cpp @@ -90,6 +90,7 @@ __rmw_destroy_service( rmw_free(const_cast(service->service_name)); rmw_service_free(service); + RCUTILS_CAN_RETURN_WITH_ERROR_OF(RMW_RET_ERROR); // on completion return ret; } } // namespace rmw_fastrtps_shared_cpp diff --git a/rmw_fastrtps_shared_cpp/src/rmw_wait_set.cpp b/rmw_fastrtps_shared_cpp/src/rmw_wait_set.cpp index acba1e184..2fbfa2ac5 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_wait_set.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_wait_set.cpp @@ -96,6 +96,8 @@ __rmw_destroy_wait_set(const char * identifier, rmw_wait_set_t * wait_set) rmw_free(wait_set->data); } rmw_wait_set_free(wait_set); + + RCUTILS_CAN_RETURN_WITH_ERROR_OF(RMW_RET_ERROR); // on completion return result; } } // namespace rmw_fastrtps_shared_cpp diff --git a/rmw_fastrtps_shared_cpp/src/subscription.cpp b/rmw_fastrtps_shared_cpp/src/subscription.cpp index 1fc5c18b7..c66955350 100644 --- a/rmw_fastrtps_shared_cpp/src/subscription.cpp +++ b/rmw_fastrtps_shared_cpp/src/subscription.cpp @@ -62,6 +62,7 @@ destroy_subscription( rmw_free(const_cast(subscription->topic_name)); rmw_subscription_free(subscription); + RCUTILS_CAN_RETURN_WITH_ERROR_OF(RMW_RET_ERROR); // on completion return ret; } } // namespace rmw_fastrtps_shared_cpp