crashes.c 558 Bytes
Newer Older
1
#include "clar_libgit2.h"
Vicent Martí committed
2 3 4 5 6 7 8 9

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

	cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
10
	cl_git_pass(git_reference_symbolic_create(&ref, repo, REFNAME, "refs/heads/master", 0));
Vicent Martí committed
11 12 13
	cl_git_pass(git_reference_lookup(&ref2, repo, REFNAME));
	cl_git_pass(git_reference_delete(ref));
	/* reference is gone from disk, so reloading it will fail */
Ben Straub committed
14
	cl_git_fail(git_reference_reload(ref2));
15 16

	git_repository_free(repo);
Vicent Martí committed
17
}