Commit 391575638c61164eea5523ca7bb291d094b6f2d6

Carlos Martín Nieto 2011-11-22T11:16:44

Free the created refs in git_remote_update_tips

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/remote.c b/src/remote.c
index cda1a15..a222023 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -261,6 +261,7 @@ 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");
 	}
@@ -275,6 +276,8 @@ int git_remote_update_tips(git_remote *remote)
 		error = git_reference_create_oid(&ref, remote->repo, refname, &head->oid, 1);
 		if (error < GIT_SUCCESS)
 			return error;
+
+		git_reference_free(ref);
 	}
 
 	return GIT_SUCCESS;