libgit2/libgit2 — Issue #518: refs: double free or corruption (fasttop)
Author: jdavid
Created: 2011-12-24 22:52:20+00:00
State: open

On the development branch, with this code:

#include
void main()
{
git_repository *repo;
git_reference *ref, *ref2;
const char *REFNAME = "refs/heads/xxx";

git_repository_open(&repo, "/tmp/test.git");
git_reference_create_symbolic(&ref, repo, REFNAME, "refs/heads/master", 0);
git_reference_lookup(&ref2, repo, REFNAME);
git_reference_delete(ref);
git_reference_reload(ref2);
}

I get this error:

*** glibc detected *** ./a.out: double free or corruption (fasttop): 0x0000000000d5f500 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x76156)[0x7f2d089eb156]
/lib64/libc.so.6(cfree+0x6c)[0x7f2d089effdc]
/usr/lib64/libgit2.so.0(git_reference_free+0x39)[0x7f2d08d11c39]
/usr/lib64/libgit2.so.0(+0x10e4a)[0x7f2d08d11e4a]
/usr/lib64/libgit2.so.0(git_reference_reload+0x16)[0x7f2d08d12f76]
./a.out[0x400847]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x7f2d0899709d]
./a.out[0x400719]
======= Memory map: ========