Skip to content

Commit

Permalink
Small cleanup for token error handling.
Browse files Browse the repository at this point in the history
We know that the pointer won't be NULL by that point,
so we don't need the check.

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette committed Feb 7, 2024
1 parent b7733d4 commit 478c0e6
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions rmw_zenoh_cpp/src/rmw_zenoh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,8 @@ rmw_create_node(
NULL
);
auto free_token = rcpputils::make_scope_exit(
[node]() {
if (node->data != nullptr) {
rmw_node_data_t * node_data = static_cast<rmw_node_data_t *>(node->data);
z_drop(z_move(node_data->token));
}
[node_data]() {
z_drop(z_move(node_data->token));
});
if (!z_check(node_data->token)) {
RCUTILS_LOG_ERROR_NAMED(
Expand All @@ -330,11 +327,11 @@ rmw_create_node(
return nullptr;
}

free_token.cancel();
free_node_data.cancel();
free_namespace.cancel();
free_name.cancel();
free_node.cancel();
free_token.cancel();
return node;
}

Expand Down

0 comments on commit 478c0e6

Please sign in to comment.