summaryrefslogtreecommitdiff
path: root/src/reflog.c
diff options
context:
space:
mode:
authorschu <schu-github@schulog.org>2011-08-11 19:38:13 +0200
committerVicent Marti <tanoku@gmail.com>2011-11-06 03:15:26 +0100
commit75abd2b92452782a9e6cee6ed5041339bd00c5bf (patch)
treed2ef55289b8d10e1caa813a86fdebb1e00436489 /src/reflog.c
parent4fd89fa0392967fabb905c7f4001cd4834f11dbd (diff)
downloadlibgit2-75abd2b92452782a9e6cee6ed5041339bd00c5bf.tar.gz
Free all used references in the source tree
Since references are not owned by the repository anymore we have to free them manually now. Signed-off-by: schu <schu-github@schulog.org>
Diffstat (limited to 'src/reflog.c')
-rw-r--r--src/reflog.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/reflog.c b/src/reflog.c
index 5fc357a0f..81e171acf 100644
--- a/src/reflog.c
+++ b/src/reflog.c
@@ -218,8 +218,12 @@ int git_reflog_write(git_reference *ref, const git_oid *oid_old,
return git__rethrow(error, "Failed to write reflog. Cannot resolve reference `%s`", ref->name);
oid = git_reference_oid(r);
- if (oid == NULL)
+ if (oid == NULL) {
+ git_reference_free(r);
return git__throw(GIT_ERROR, "Failed to write reflog. Cannot resolve reference `%s`", r->name);
+ }
+
+ git_reference_free(r);
git_oid_to_string(new, GIT_OID_HEXSZ+1, oid);