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

Fix heap-use-after-free and memory leaks reported from test_node.cpp #719

Merged
merged 1 commit into from
May 15, 2019
Merged
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 rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,10 @@ NodeParameters::set_parameters_atomically(const std::vector<rclcpp::Parameter> &
// assumption: the parameter to be undeclared should be in the parameter infos map
assert(it != parameters_.end());
if (it != parameters_.end()) {
// Remove it and update the parameter event message.
parameters_.erase(it);
// Update the parameter event message and remove it.
parameter_event_msg.deleted_parameters.push_back(
rclcpp::Parameter(it->first, it->second.value).to_parameter_msg());
parameters_.erase(it);
}
}

Expand Down
3 changes: 3 additions & 0 deletions rclcpp/src/rclcpp/node_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ rcl_node_options_t_destructor(rcl_node_options_t * node_options)
"failed to finalize rcl node options: %s", rcl_get_error_string().str);
rcl_reset_error();
}

delete node_options;
node_options = nullptr;
}
}
} // namespace detail
Expand Down