libgit2/libgit2 — pull request #2064 by piki (2014-01-20 17:52:46+00:00)
Title: Fix a couple of corner cases and an undefined behavior

I ran clang `scan-build` on code derived from `src/buffer.c` and am upstreaming a couple of fixes.

- Fix a resource leak in `git_buf_try_grow` when `realloc` returns NULL.
- Minor fix to bounds on an assert in `git_buf_join`.
- `assert` in `git_buf_join` to keep static analyzers happy.
- Don't pass NULL `str_a` to `memmove`. It's undefined.
- Add unit tests for calls to `git_buf_join` where `buf->ptr` and `str_a` overlap.