Commit e45423dd2c5ef8262f70605b81c6da0751d000a3

Ben Straub 2012-11-13T05:45:08

Merge pull request #1065 from nulltoken/fix/memory-leak Fix memory leaks

diff --git a/src/transports/local.c b/src/transports/local.c
index cbf6a4e..84acc79 100644
--- a/src/transports/local.c
+++ b/src/transports/local.c
@@ -227,6 +227,7 @@ static int local_negotiate_fetch(
 			git_oid_cpy(&rhead->loid, git_object_id(obj));
 		else if (error != GIT_ENOTFOUND)
 			return error;
+		git_object_free(obj);
 		giterr_clear();
 	}
 
diff --git a/tests-clar/network/fetchlocal.c b/tests-clar/network/fetchlocal.c
index b5bb176..bff0bb0 100644
--- a/tests-clar/network/fetchlocal.c
+++ b/tests-clar/network/fetchlocal.c
@@ -52,6 +52,8 @@ void test_network_fetchlocal__partial(void)
 	cl_git_pass(git_remote_download(origin, transfer_cb, &callcount));
 	cl_git_pass(git_remote_update_tips(origin));
 
+	git_strarray_free(&refnames);
+
 	cl_git_pass(git_reference_list(&refnames, repo, GIT_REF_LISTALL));
 	cl_assert_equal_i(19, refnames.count); /* 18 remote + 1 local */
 	cl_assert(callcount > 0);