From 24fa21f38e15b0c929cafb0c072e47708f18d663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Fri, 26 Jun 2015 18:59:53 +0200 Subject: index, iterator, fetchhead: plug leaks --- src/iterator.c | 3 +++ tests/fetchhead/nonetwork.c | 3 +++ tests/index/racy.c | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/iterator.c b/src/iterator.c index 45eba3955..949949388 100644 --- a/src/iterator.c +++ b/src/iterator.c @@ -1926,6 +1926,9 @@ int git_iterator_walk( } done: + git__free(iterator_item); + git__free(cur_items); + if (error == GIT_ITEROVER) error = 0; diff --git a/tests/fetchhead/nonetwork.c b/tests/fetchhead/nonetwork.c index b8f74d7b6..3b750af5e 100644 --- a/tests/fetchhead/nonetwork.c +++ b/tests/fetchhead/nonetwork.c @@ -394,4 +394,7 @@ void test_fetchhead_nonetwork__create_when_refpecs_given(void) cl_git_pass(git_repository_fetchhead_foreach(g_repo, find_master, NULL)); cl_assert(find_master_called); cl_assert(found_master); + + git_remote_free(remote); + git_buf_free(&path); } diff --git a/tests/index/racy.c b/tests/index/racy.c index 3a4bc439e..fda1ed239 100644 --- a/tests/index/racy.c +++ b/tests/index/racy.c @@ -108,7 +108,7 @@ void test_index_racy__empty_file_after_smudge(void) const git_index_entry *entry; /* Make sure we do have a timestamp */ - cl_git_pass(git_repository_index(&index, g_repo)); + cl_git_pass(git_repository_index__weakptr(&index, g_repo)); cl_git_pass(git_index_write(index)); cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(g_repo), "A")); @@ -140,4 +140,7 @@ void test_index_racy__empty_file_after_smudge(void) cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, index, NULL)); cl_assert_equal_i(1, git_diff_num_deltas(diff)); + + git_buf_free(&path); + git_diff_free(diff); } -- cgit v1.2.1