summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2012-01-19 17:05:16 +0100
committerCarlos Martín Nieto <carlos@cmartin.tk>2012-01-19 17:05:16 +0100
commit585a2eb75adb71cb6bf73e548a23f86b30de2d4a (patch)
treedaae71d32dbcfd2673e4b323e844cd9f365719ef /src
parent43c6dd6fb02ec253b7e8aaf249d0070b253a6c83 (diff)
downloadlibgit2-585a2eb75adb71cb6bf73e548a23f86b30de2d4a.tar.gz
remote: don't try to free the ref on error
On error, the pointer could be pointing anywhere.
Diffstat (limited to 'src')
-rw-r--r--src/remote.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/remote.c b/src/remote.c
index ef42c6e2a..cdf28789b 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -279,9 +279,10 @@ int git_remote_update_tips(git_remote *remote)
if (!strcmp(head->name, GIT_HEAD_FILE)) {
error = git_reference_create_oid(&ref, remote->repo, GIT_FETCH_HEAD_FILE, &head->oid, 1);
i = 1;
- git_reference_free(ref);
if (error < GIT_SUCCESS)
return git__rethrow(error, "Failed to update FETCH_HEAD");
+
+ git_reference_free(ref);
}
for (; i < refs->length; ++i) {