git_buf_clear does not free allocated memory associated with a git_buf. Use `git_buf_free` instead to correctly free its memory and plug the memory leak.