Crash after saving to a git repo

Anton Lundin glance at
Mon Mar 31 10:57:48 PDT 2014

On 31 March, 2014 - Linus Torvalds wrote:

> This very much *looks* like a libgit2 bug. Now, it's obviously
> possible that somebody else did the real invalid free(), then
> re-allocated something, and then libgit2 did what *should* have been
> the real free, but quite frankly, with valgrind claiming that the
> allocation was originally done by _dl_init(), I doubt it. It smells
> more like libgit2 used to have some static string for the error
> message, and it tried to free() that when it sets a new error message.
> The fact that it goes away when you update libgit2 obviously also
> implies that this is a libgit2 issue.
> That said, I looked at libgit2:src/errors.c, and I certainly don't see
> anything obvious. All the accesses seem to be through a properly
> malloc'ed area (either using strdup() or using the libgit2 version of
> our "struct membuffer"-like allocation wrappers.
> Does this trigger on the very first save (after you've loaded from
> XML) or have you done some git-load/save op before? I'm wondering if
> we maybe don't clean up some state properly, but my primary guess is
> that it's just a libgit2 bug.

I trigger this after loading my xml file and then trying to save it to a
new branch in a fresh git-repo.

I'm kinda confused that I'm seem to be the only one hitting this one,
because i can reproduce it to 100%.


Anton Lundin	+46702-161604

More information about the subsurface mailing list