@@ -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 init_options -> localhost_only = RMW_LOCALHOST_ONLY_DEFAULT ;
@@ -135,8 +135,16 @@ rmw_init_options_copy(
135135 }
136136 memcpy (dst , src , sizeof (rmw_init_options_t ));
137137
138+ rcutils_allocator_t allocator = src -> allocator ;
139+ RCUTILS_CHECK_ALLOCATOR (& allocator , return RMW_RET_INVALID_ARGUMENT );
140+ dst -> enclave = rcutils_strdup (src -> enclave , allocator );
141+ if (NULL != src -> enclave && NULL == dst -> enclave ) {
142+ return RMW_RET_BAD_ALLOC ;
143+ }
144+
138145 rmw_uxrce_mempool_item_t * memory_node = get_memory (& init_options_memory );
139146 if (!memory_node ) {
147+ allocator .deallocate (dst -> enclave , allocator .state );
140148 RMW_UROS_TRACE_MESSAGE ("Not available memory node" )
141149 return RMW_RET_ERROR ;
142150 }
@@ -155,7 +163,8 @@ rmw_init_options_fini(
155163 rmw_init_options_t * init_options )
156164{
157165 RMW_CHECK_ARGUMENT_FOR_NULL (init_options , RMW_RET_INVALID_ARGUMENT );
158- RCUTILS_CHECK_ALLOCATOR (& (init_options -> allocator ), return RMW_RET_INVALID_ARGUMENT );
166+ rcutils_allocator_t * allocator = & init_options -> allocator ;
167+ RCUTILS_CHECK_ALLOCATOR (allocator , return RMW_RET_INVALID_ARGUMENT );
159168 RMW_CHECK_TYPE_IDENTIFIERS_MATCH (
160169 init_options -> implementation_identifier ,
161170 RMW_RET_INCORRECT_RMW_IMPLEMENTATION );
@@ -176,6 +185,7 @@ rmw_init_options_fini(
176185 return RMW_RET_ERROR ;
177186 }
178187
188+ allocator -> deallocate (init_options -> enclave , allocator -> state );
179189
180190 * init_options = rmw_get_zero_initialized_init_options ();
181191
0 commit comments