Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure to duplicate the enclave name. #216

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion rmw_zenoh_cpp/src/rmw_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,15 @@ rmw_init(const rmw_init_options_t * options, rmw_context_t * context)
});

// Set the enclave.
context->impl->enclave = options->enclave;
context->impl->enclave = rcutils_strdup(options->enclave, *allocator);
RMW_CHECK_FOR_NULL_WITH_MSG(
context->impl->enclave,
"failed to allocate enclave",
return RMW_RET_BAD_ALLOC);
auto free_enclave = rcpputils::make_scope_exit(
[context, allocator]() {
allocator->deallocate(context->impl->enclave, allocator->state);
});

// Initialize context's implementation
context->impl->is_shutdown = false;
Expand Down Expand Up @@ -363,6 +371,7 @@ rmw_init(const rmw_init_options_t * options, rmw_context_t * context)
impl_destructor.cancel();
free_guard_condition_data.cancel();
free_guard_condition.cancel();
free_enclave.cancel();
free_options.cancel();
impl_destructor.cancel();
free_impl.cancel();
Expand Down Expand Up @@ -434,6 +443,8 @@ rmw_context_fini(rmw_context_t * context)
allocator->deallocate(context->impl->graph_guard_condition, allocator->state);
context->impl->graph_guard_condition = nullptr;

allocator->deallocate(context->impl->enclave, allocator->state);

RMW_TRY_DESTRUCTOR(context->impl->~rmw_context_impl_t(), rmw_context_impl_t *, );

allocator->deallocate(context->impl, allocator->state);
Expand Down
Loading