Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 8 additions & 0 deletions rcl/src/rcl/publisher.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ rcl_publisher_init(
goto cleanup;
fail:
if (publisher->impl) {
if (publisher->impl->rmw_handle) {
rmw_ret_t rmw_fail_ret = rmw_destroy_publisher(
rcl_node_get_rmw_handle(node), publisher->impl->rmw_handle);
if (RMW_RET_OK != rmw_fail_ret) {
RCUTILS_SAFE_FWRITE_TO_STDERR(rmw_get_error_string().str);
}
}

allocator->deallocate(publisher->impl, allocator->state);
publisher->impl = NULL;
}
Expand Down
8 changes: 8 additions & 0 deletions rcl/src/rcl/subscription.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,14 @@ rcl_subscription_init(
goto cleanup;
fail:
if (subscription->impl) {
if (subscription->impl->rmw_handle) {
rmw_ret_t rmw_fail_ret = rmw_destroy_subscription(
rcl_node_get_rmw_handle(node), subscription->impl->rmw_handle);
if (RMW_RET_OK != rmw_fail_ret) {
RCUTILS_SAFE_FWRITE_TO_STDERR(rmw_get_error_string().str);
}
}

allocator->deallocate(subscription->impl, allocator->state);
}
ret = fail_ret;
Expand Down