Skip to content

Commit

Permalink
Fix free args function
Browse files Browse the repository at this point in the history
  • Loading branch information
alvinmatias69 committed Aug 31, 2023
1 parent 8527359 commit 29779d7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,19 @@ struct arguments parse_args(int argc, char *argv[]) {
return args;
}

// TODO: free remaining args
void free_args(struct arguments *args) {
if (strnlen(args->input, MAX_INPUT_LENGTH) > 0)
free(args->input);
if (strnlen(args->target, MAX_INPUT_LENGTH) > 0)
if (args->custom_target)
free(args->target);
if (strnlen(args->only, MAX_INPUT_LENGTH) > 0)
if (args->has_only)
free(args->only);
if (strnlen(args->exclude, MAX_INPUT_LENGTH) > 0)
if (args->has_exclude)
free(args->exclude);
if (strnlen(args->template_file, MAX_INPUT_LENGTH) > 0)
free(args->template_file);
if (args->has_custom_ctags_bin)
free(args->ctags_bin_path);
}

void print_args(struct arguments *args) {
Expand Down

0 comments on commit 29779d7

Please sign in to comment.