diff --git a/rmw_fastrtps_cpp/src/rmw_node.cpp b/rmw_fastrtps_cpp/src/rmw_node.cpp index a9f533e9a..a4915afa0 100644 --- a/rmw_fastrtps_cpp/src/rmw_node.cpp +++ b/rmw_fastrtps_cpp/src/rmw_node.cpp @@ -206,11 +206,11 @@ get_security_file_paths( if (rcutils_is_readable(file_path)) { security_files_paths[i] = file_prefix + std::string(file_path); } else { - free(file_path); + allocator.deallocate(file_path, allocator.state); return false; } - free(file_path); + allocator.deallocate(file_path, allocator.state); } return true;