Free the git_index in all code paths.
Be cautious about NULL pointers from geterr_last().