diff --git a/rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp b/rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp index d0a1fc4..c969ace 100644 --- a/rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp +++ b/rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp @@ -493,10 +493,10 @@ NodeParameters::set_parameters_atomically(const std::vector & // 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); } } diff --git a/rclcpp/src/rclcpp/node_options.cpp b/rclcpp/src/rclcpp/node_options.cpp index c080f74..68d67f1 100644 --- a/rclcpp/src/rclcpp/node_options.cpp +++ b/rclcpp/src/rclcpp/node_options.cpp @@ -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