summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2012-10-15 16:35:10 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2012-10-15 16:35:10 +0200
commit7ae5ab5696d1810eeb4583ef77145edccdb41308 (patch)
tree8e02e27eefe848d62c9b116ea23d294565be5f79 /src
parent47f44b6ee424921cf5aef064fe6ecf768c6ec5ea (diff)
downloadlibgit2-7ae5ab5696d1810eeb4583ef77145edccdb41308.tar.gz
Fix leak in the tests
Also introduce the slective ref trimming promised but also missed in the previous commit.
Diffstat (limited to 'src')
-rw-r--r--src/refs.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/refs.c b/src/refs.c
index 9e2311b07..740d99eda 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -211,8 +211,6 @@ static int loose_lookup(git_reference *ref)
if (!updated)
return 0;
- git_buf_rtrim(&ref_file);
-
if (ref->flags & GIT_REF_SYMBOLIC) {
git__free(ref->target.symbolic);
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) {
ref->flags |= GIT_REF_SYMBOLIC;
+ git_buf_rtrim(&ref_file);
result = loose_parse_symbolic(ref, &ref_file);
} else {
ref->flags |= GIT_REF_OID;