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

Skip to content

Commit 6c5eaea

Browse files
committed
tests: plug leaks in the racy test
1 parent 7497584 commit 6c5eaea

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/diff/racy.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ void test_diff_racy__initialize(void)
1212

1313
void test_diff_racy__cleanup(void)
1414
{
15-
cl_git_sandbox_cleanup();
15+
git_repository_free(g_repo);
16+
g_repo = NULL;
17+
18+
cl_fixture_cleanup("diff_racy");
1619
}
1720

1821
void test_diff_racy__diff(void)
@@ -31,12 +34,17 @@ void test_diff_racy__diff(void)
3134

3235
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, index, NULL));
3336
cl_assert_equal_i(0, git_diff_num_deltas(diff));
37+
git_diff_free(diff);
3438

3539
/* Change its contents quickly, so we get the same timestamp */
3640
cl_git_mkfile(path.ptr, "B");
3741

3842
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, index, NULL));
3943
cl_assert_equal_i(1, git_diff_num_deltas(diff));
44+
45+
git_index_free(index);
46+
git_diff_free(diff);
47+
git_buf_free(&path);
4048
}
4149

4250
void test_diff_racy__write_index_just_after_file(void)

0 commit comments

Comments
 (0)