Fix leaks
Merge pull request #1943 from libgit2/ntk/fix/leaks

Fix leaks