Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 24fa21f

Browse files
committed
index, iterator, fetchhead: plug leaks
1 parent afd8a94 commit 24fa21f

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/iterator.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,6 +1926,9 @@ int git_iterator_walk(
19261926
}
19271927

19281928
done:
1929+
git__free(iterator_item);
1930+
git__free(cur_items);
1931+
19291932
if (error == GIT_ITEROVER)
19301933
error = 0;
19311934

tests/fetchhead/nonetwork.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,4 +394,7 @@ void test_fetchhead_nonetwork__create_when_refpecs_given(void)
394394
cl_git_pass(git_repository_fetchhead_foreach(g_repo, find_master, NULL));
395395
cl_assert(find_master_called);
396396
cl_assert(found_master);
397+
398+
git_remote_free(remote);
399+
git_buf_free(&path);
397400
}

tests/index/racy.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void test_index_racy__empty_file_after_smudge(void)
108108
const git_index_entry *entry;
109109

110110
/* Make sure we do have a timestamp */
111-
cl_git_pass(git_repository_index(&index, g_repo));
111+
cl_git_pass(git_repository_index__weakptr(&index, g_repo));
112112
cl_git_pass(git_index_write(index));
113113

114114
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)
140140

141141
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, index, NULL));
142142
cl_assert_equal_i(1, git_diff_num_deltas(diff));
143+
144+
git_buf_free(&path);
145+
git_diff_free(diff);
143146
}

0 commit comments

Comments
 (0)