commit 7f11502cb5629607446cbb42652120095794f8e0 from: Hiltjo Posthuma date: Wed Aug 28 17:15:36 2019 UTC fix possible use-after-free in got_worktree_close() commit - fd9f4a2de0e0bb2450a8afeae120a4b14ae10272 commit + 7f11502cb5629607446cbb42652120095794f8e0 blob - 8921d44e97b711564ee7ae00213598871b7242e3 blob + 3991862f6937a45384001a29a872cbffe9b742e1 --- lib/worktree.c +++ lib/worktree.c @@ -455,7 +455,6 @@ const struct got_error * got_worktree_close(struct got_worktree *worktree) { const struct got_error *err = NULL; - free(worktree->root_path); free(worktree->repo_path); free(worktree->path_prefix); free(worktree->base_commit_id); @@ -464,6 +463,7 @@ got_worktree_close(struct got_worktree *worktree) if (close(worktree->lockfd) != 0) err = got_error_from_errno2("close", got_worktree_get_root_path(worktree)); + free(worktree->root_path); free(worktree); return err; }