commit e4a0e26d952b5d39d33113b47ba98dca4f0e5539 from: Stefan Sperling date: Thu Feb 20 15:08:56 2020 UTC prevent possible double-free introduced in previous commit commit - 55cccc343d923777c51fabd4ea6c48ee0a5e3306 commit + e4a0e26d952b5d39d33113b47ba98dca4f0e5539 blob - 80c74f19c7f37e1021e47198e0979cdb1300d6d8 blob + 71e5672490f2239c78f28248f04f04464ce7048f --- tog/tog.c +++ tog/tog.c @@ -5218,7 +5218,7 @@ cmd_tree(int argc, char *argv[]) repo_path = strdup(got_worktree_get_repo_path(worktree)); else - repo_path = cwd; + repo_path = strdup(cwd); } if (repo_path == NULL) { error = got_error_from_errno("strdup"); @@ -5282,6 +5282,7 @@ cmd_tree(int argc, char *argv[]) error = view_loop(view); done: free(repo_path); + free(cwd); free(commit_id); if (commit) got_object_commit_close(commit);