Plug some leaks
Check the result of git_buf_joinpath
Added missing error handling path
Check for OOM
Merge pull request #2785 from jacquesg/coverity

Coverity fixes