diff --git a/rmw_zenoh_cpp/src/rmw_zenoh.cpp b/rmw_zenoh_cpp/src/rmw_zenoh.cpp index d579be76..913da9ac 100644 --- a/rmw_zenoh_cpp/src/rmw_zenoh.cpp +++ b/rmw_zenoh_cpp/src/rmw_zenoh.cpp @@ -2055,13 +2055,10 @@ static z_owned_bytes_map_t create_map_and_set_sequence_num( z_bytes_t guid_bytes; guid_bytes.len = RMW_GID_STORAGE_SIZE; - guid_bytes.start = static_cast(malloc(RMW_GID_STORAGE_SIZE)); - memcpy(static_cast(const_cast(guid_bytes.start)), guid, RMW_GID_STORAGE_SIZE); + guid_bytes.start = guid; z_bytes_map_insert_by_copy(&map, z_bytes_new("client_guid"), guid_bytes); - free(const_cast(guid_bytes.start)); - free_attachment_map.cancel(); return map;