libgit2/libgit2 — pull request #1628 by arrbee (2013-05-31 21:19:32+00:00)
Title: Minor object lifetime paranoia

This started out with just trying to zero out some of the major structures before we free them (e.g. repos, odb, refdb) so that bindings that are having reference management issues can find their problems more quickly. The extra overhead of zeroing the memory for these items is pretty small and the clarity that it will bring for binding authors seems worth it.

As I was looking through the various cleanup routines, I was looking at the `git_mutex_init` / `git_mutex_free` pairings and realized that we're also not checking the return value of `git_mutex_init`. So I also walked through and made sure that we were checking the return code and reporting an error if it failed. This is one of those things like allocation failure that is probably only going to happen when the user is largely screwed, but I thought it was worth taking care of.