fix memory leak in install_symlink() error path; spotted by semarie
diff --git a/lib/worktree.c b/lib/worktree.c
index 7ac3e89..be2544b 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -1006,8 +1006,10 @@ install_symlink(struct got_worktree *worktree, const char *ondisk_path,
*/
resolved_path = realpath(abspath ? abspath : target_path, NULL);
if (resolved_path == NULL) {
- if (errno != ENOENT)
- return got_error_from_errno2("realpath", target_path);
+ if (errno != ENOENT) {
+ err = got_error_from_errno2("realpath", target_path);
+ goto done;
+ }
}
/* Only allow symlinks pointing at paths within the work tree. */