mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-04 09:18:48 +00:00
Fix leak in the tests
Also introduce the slective ref trimming promised but also missed in the previous commit.
This commit is contained in:
parent
47f44b6ee4
commit
7ae5ab5696
@ -211,8 +211,6 @@ static int loose_lookup(git_reference *ref)
|
|||||||
if (!updated)
|
if (!updated)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
git_buf_rtrim(&ref_file);
|
|
||||||
|
|
||||||
if (ref->flags & GIT_REF_SYMBOLIC) {
|
if (ref->flags & GIT_REF_SYMBOLIC) {
|
||||||
git__free(ref->target.symbolic);
|
git__free(ref->target.symbolic);
|
||||||
ref->target.symbolic = NULL;
|
ref->target.symbolic = NULL;
|
||||||
@ -222,6 +220,7 @@ static int loose_lookup(git_reference *ref)
|
|||||||
|
|
||||||
if (git__prefixcmp((const char *)(ref_file.ptr), GIT_SYMREF) == 0) {
|
if (git__prefixcmp((const char *)(ref_file.ptr), GIT_SYMREF) == 0) {
|
||||||
ref->flags |= GIT_REF_SYMBOLIC;
|
ref->flags |= GIT_REF_SYMBOLIC;
|
||||||
|
git_buf_rtrim(&ref_file);
|
||||||
result = loose_parse_symbolic(ref, &ref_file);
|
result = loose_parse_symbolic(ref, &ref_file);
|
||||||
} else {
|
} else {
|
||||||
ref->flags |= GIT_REF_OID;
|
ref->flags |= GIT_REF_OID;
|
||||||
|
@ -212,6 +212,7 @@ void test_refs_read__trailing(void)
|
|||||||
cl_git_pass(git_reference_lookup(&test, g_repo, "refs/heads/test"));
|
cl_git_pass(git_reference_lookup(&test, g_repo, "refs/heads/test"));
|
||||||
cl_git_pass(git_reference_lookup(&trailing, g_repo, "refs/heads/trailing"));
|
cl_git_pass(git_reference_lookup(&trailing, g_repo, "refs/heads/trailing"));
|
||||||
cl_git_pass(git_oid_cmp(git_reference_oid(test), git_reference_oid(trailing)));
|
cl_git_pass(git_oid_cmp(git_reference_oid(test), git_reference_oid(trailing)));
|
||||||
|
git_reference_free(trailing);
|
||||||
cl_git_pass(git_reference_lookup(&trailing, g_repo, "FETCH_HEAD"));
|
cl_git_pass(git_reference_lookup(&trailing, g_repo, "FETCH_HEAD"));
|
||||||
|
|
||||||
git_reference_free(test);
|
git_reference_free(test);
|
||||||
|
Loading…
Reference in New Issue
Block a user