diff options
| author | Ben Straub <bs@github.com> | 2013-11-14 14:05:52 -0800 |
|---|---|---|
| committer | Ben Straub <bs@github.com> | 2013-11-14 14:05:52 -0800 |
| commit | 1782038144ef3413831801bb9c2f3038a84ac6f4 (patch) | |
| tree | f074cc30890a20f5418c10fae1815ca516588a27 /tests/refs/crashes.c | |
| parent | 7b947bf5cc59eefa83c28eb5f5fd8434207ebb8b (diff) | |
| download | libgit2-1782038144ef3413831801bb9c2f3038a84ac6f4.tar.gz | |
Rename tests-clar to tests
Diffstat (limited to 'tests/refs/crashes.c')
| -rw-r--r-- | tests/refs/crashes.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/refs/crashes.c b/tests/refs/crashes.c new file mode 100644 index 000000000..5a1885a7a --- /dev/null +++ b/tests/refs/crashes.c @@ -0,0 +1,20 @@ +#include "clar_libgit2.h" + +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"))); + cl_git_pass(git_reference_symbolic_create(&ref, repo, REFNAME, "refs/heads/master", 0)); + cl_git_pass(git_reference_lookup(&ref2, repo, REFNAME)); + cl_git_pass(git_reference_delete(ref)); + git_reference_free(ref); + git_reference_free(ref2); + + /* reference is gone from disk, so reloading it will fail */ + cl_git_fail(git_reference_lookup(&ref2, repo, REFNAME)); + + git_repository_free(repo); +} |
