Skip to content

Commit

Permalink
Add error checking into ros_topic_name_to_zenoh_key
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette committed Jan 8, 2024
1 parent 9d9f6f6 commit ce6af2b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rmw_zenoh_cpp/src/rmw_zenoh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ z_owned_keyexpr_t ros_topic_name_to_zenoh_key(
domain_ss << domain_id;
char * stripped_topic_name = rcutils_strndup(
&topic_name[start_offset], end_offset - start_offset, *allocator);
if (stripped_topic_name == nullptr) {
return z_keyexpr_null();
}
z_owned_keyexpr_t keyexpr = z_keyexpr_join(
z_keyexpr(domain_ss.str().c_str()), z_keyexpr(stripped_topic_name));
allocator->deallocate(stripped_topic_name, allocator->state);
Expand Down

0 comments on commit ce6af2b

Please sign in to comment.