@@ -52,7 +52,7 @@ rmw_init_options_init(
5252 init_options -> instance_id = 0 ;
5353 init_options -> implementation_identifier = eprosima_microxrcedds_identifier ;
5454 init_options -> allocator = allocator ;
55- init_options -> enclave = "/" ;
55+ init_options -> enclave = NULL ;
5656 init_options -> domain_id = 0 ;
5757 init_options -> security_options = rmw_get_default_security_options ();
5858
@@ -133,9 +133,21 @@ rmw_init_options_copy(
133133 return RMW_RET_INVALID_ARGUMENT ;
134134 }
135135 memcpy (dst , src , sizeof (rmw_init_options_t ));
136-
136+ rmw_ret_t ret ;
137+ const rcutils_allocator_t * allocator = & src -> allocator ;
138+ RCUTILS_CHECK_ALLOCATOR (allocator , return RMW_RET_INVALID_ARGUMENT );
139+ if (src -> enclave != NULL ) {
140+ // Expecting this does not happen,
141+ // because rmw_microxrcedds does not support SROS 2 security feature.
142+ ret = rmw_enclave_options_copy (src -> enclave , allocator , & dst -> enclave );
143+ if (RMW_RET_OK != ret ) {
144+ return ret ;
145+ }
146+ }
137147 rmw_uxrce_mempool_item_t * memory_node = get_memory (& init_options_memory );
138148 if (!memory_node ) {
149+ rmw_enclave_options_fini (dst -> enclave , allocator );
150+ // Error already assigned below
139151 RMW_UROS_TRACE_MESSAGE ("Not available memory node" )
140152 return RMW_RET_ERROR ;
141153 }
@@ -154,7 +166,8 @@ rmw_init_options_fini(
154166 rmw_init_options_t * init_options )
155167{
156168 RMW_CHECK_ARGUMENT_FOR_NULL (init_options , RMW_RET_INVALID_ARGUMENT );
157- RCUTILS_CHECK_ALLOCATOR (& (init_options -> allocator ), return RMW_RET_INVALID_ARGUMENT );
169+ rcutils_allocator_t * allocator = & init_options -> allocator ;
170+ RCUTILS_CHECK_ALLOCATOR (allocator , return RMW_RET_INVALID_ARGUMENT );
158171 RMW_CHECK_TYPE_IDENTIFIERS_MATCH (
159172 init_options -> implementation_identifier ,
160173 RMW_RET_INCORRECT_RMW_IMPLEMENTATION );
@@ -175,6 +188,15 @@ rmw_init_options_fini(
175188 return RMW_RET_ERROR ;
176189 }
177190
191+ rmw_ret_t ret ;
192+ if (init_options -> enclave != NULL ) {
193+ // Expecting this does not happen,
194+ // because rmw_microxrcedds does not support SROS 2 security feature.
195+ ret = rmw_enclave_options_fini (init_options -> enclave , allocator );
196+ if (ret != RMW_RET_OK ) {
197+ return ret ;
198+ }
199+ }
178200
179201 * init_options = rmw_get_zero_initialized_init_options ();
180202
0 commit comments