Merge pull request #2212 from libgit2/rb/submodule-use-after-free Fix use-after-free in submodule reload code and other memory leaks