Skip to content

Commit

Permalink
update usage of rcutils_join_path() (#208)
Browse files Browse the repository at this point in the history
* update usage of rcutils_join_path()

* use allocator to free too
  • Loading branch information
wjwwood authored Jun 17, 2018
1 parent 636721d commit 8ee72cd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rmw_fastrtps_cpp/src/rmw_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ get_security_file_paths(
std::string file_prefix("file://");

for (size_t i = 0; i < num_files; i++) {
char * file_path = rcutils_join_path(node_secure_root, file_names[i]);
rcutils_allocator_t allocator = rcutils_get_default_allocator();
char * file_path = rcutils_join_path(node_secure_root, file_names[i], allocator);

if (!file_path) {
return false;
Expand All @@ -205,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;
Expand Down

0 comments on commit 8ee72cd

Please sign in to comment.