Skip to content

Commit

Permalink
Shrink parameter files
Browse files Browse the repository at this point in the history
  • Loading branch information
sloretz committed Jun 5, 2018
1 parent be5b5f2 commit 0004896
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions rcl/src/rcl/arguments.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,18 @@ rcl_parse_arguments(
allocator.deallocate(args_impl->remap_rules, allocator.state);
args_impl->remap_rules = NULL;
}
// Shrink Parameter files
if (0 == args_impl->num_param_files_args) {
allocator.deallocate(args_impl->parameter_files, allocator.state);
args_impl->parameter_files = NULL;
} else if (args_impl->num_param_files_args < argc) {
args_impl->parameter_files = rcutils_reallocf(
args_impl->parameter_files, sizeof(char *) * args_impl->num_param_files_args, &allocator);
if (NULL == args_impl->parameter_files) {
ret = RCL_RET_BAD_ALLOC;
goto fail;
}
}
// Shrink unparsed_args
if (0 == args_impl->num_unparsed_args) {
// No unparsed args
Expand Down

0 comments on commit 0004896

Please sign in to comment.