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

Use _var to fix possible leaks #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions rmw_opendds_cpp/src/DDSClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bool DDSClient::take(rmw_service_info_t * request_header, void * ros_reply) cons

void DDSClient::add_to(OpenDDSNode * dds_node)
{
DDS::TopicDescription_ptr rtd = reader_->get_topicdescription();
DDS::TopicDescription_var rtd = reader_->get_topicdescription();
if (!rtd) {
throw std::runtime_error("get_topicdescription failed");
}
Expand All @@ -54,7 +54,7 @@ void DDSClient::add_to(OpenDDSNode * dds_node)
}
dds_node->add_sub(reader_->get_instance_handle(), name.in(), type_name.in()); //?? double-check

DDS::Topic_ptr wt = writer_->get_topic();
DDS::Topic_var wt = writer_->get_topic();
if (!wt) {
throw std::runtime_error("writer->get_topic failed");
}
Expand Down
4 changes: 2 additions & 2 deletions rmw_opendds_cpp/src/DDSServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bool DDSServer::send(const rmw_request_id_t * request_header, const void * ros_r

void DDSServer::add_to(OpenDDSNode * dds_node)
{
DDS::TopicDescription_ptr rtd = reader_->get_topicdescription();
DDS::TopicDescription_var rtd = reader_->get_topicdescription();
if (!rtd) {
throw std::runtime_error("get_topicdescription failed");
}
Expand All @@ -54,7 +54,7 @@ void DDSServer::add_to(OpenDDSNode * dds_node)
}
dds_node->add_sub(reader_->get_instance_handle(), name.in(), type_name.in());

DDS::Topic_ptr wt = writer_->get_topic();
DDS::Topic_var wt = writer_->get_topic();
if (!wt) {
throw std::runtime_error("writer->get_topic failed");
}
Expand Down
4 changes: 2 additions & 2 deletions rmw_opendds_cpp/src/OpenDDSNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,12 @@ OpenDDSNode::OpenDDSNode(rmw_context_t & context, const char * name, const char
throw std::runtime_error("configureTransport failed");
}

DDS::Subscriber_ptr sub = dp_->get_builtin_subscriber();
DDS::Subscriber_var sub = dp_->get_builtin_subscriber();
if (!sub) {
throw std::runtime_error("get_builtin_subscriber failed");
}
// setup publisher listener
DDS::DataReader_ptr dr = sub->lookup_datareader(OpenDDS::DCPS::BUILT_IN_PUBLICATION_TOPIC);
DDS::DataReader_var dr = sub->lookup_datareader(OpenDDS::DCPS::BUILT_IN_PUBLICATION_TOPIC);
auto pub_dr = dynamic_cast<DDS::PublicationBuiltinTopicDataDataReader*>(dr);
if (!pub_dr) {
throw std::runtime_error("builtin publication datareader is null");
Expand Down