Add safe memset and use it

This adds a `git__memset` routine that will not be optimized away
and updates the places where I memset() right before a free() call
to use it.