File tree Expand file tree Collapse file tree
rclcpp/src/rclcpp/node_interfaces Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525#include " rcl_interfaces/srv/list_parameters.hpp"
2626#include " rclcpp/create_publisher.hpp"
2727#include " rclcpp/parameter_map.hpp"
28+ #include " rclcpp/scope_exit.hpp"
2829#include " rcutils/logging_macros.h"
2930#include " rmw/qos_profiles.h"
3031
@@ -76,11 +77,16 @@ NodeParameters::NodeParameters(
7677 if (RCL_RET_OK != ret) {
7778 rclcpp::exceptions::throw_from_rcl_error (ret);
7879 }
80+ auto cleanup_param_files = make_scope_exit (
81+ [¶m_files, &num_yaml_files, &options]() {
82+ for (int i = 0 ; i < num_yaml_files; ++i) {
83+ options->allocator .deallocate (param_files[i], options->allocator .state );
84+ }
85+ options->allocator .deallocate (param_files, options->allocator .state );
86+ });
7987 for (int i = 0 ; i < num_yaml_files; ++i) {
8088 yaml_paths.emplace_back (param_files[i]);
81- options->allocator .deallocate (param_files[i], options->allocator .state );
8289 }
83- options->allocator .deallocate (param_files, options->allocator .state );
8490 }
8591 };
8692
You can’t perform that action at this time.
0 commit comments