Skip to content

Commit ff07b9b

Browse files
committed
repository: fix leaking buffer in git_repository_head_for_worktree
The cleanup procedure calls `git_buf_clear` on the buffer, which simply causes it to be truncated instead of being freed. Fix the issue by calling `git_buf_free` instead.
1 parent 2245bdc commit ff07b9b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/repository.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2132,7 +2132,7 @@ int git_repository_head_for_worktree(git_reference **out, git_repository *repo,
21322132
out:
21332133
if (error)
21342134
git_reference_free(head);
2135-
git_buf_clear(&path);
2135+
git_buf_free(&path);
21362136

21372137
return error;
21382138
}

0 commit comments

Comments
 (0)