Skip to content

Commit dae8ba6

Browse files
committed
Fix memory leak of test repository object
1 parent acdc7cf commit dae8ba6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/diff/submodules.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,6 @@ void test_diff_submodules__skips_empty_includes_used(void)
449449
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
450450
git_diff *diff = NULL;
451451
diff_expects exp;
452-
git_repository *r2;
453452

454453
/* A side effect of of Git's handling of untracked directories and
455454
* auto-ignoring of ".git" entries is that a newly initialized Git
@@ -469,7 +468,11 @@ void test_diff_submodules__skips_empty_includes_used(void)
469468
cl_assert_equal_i(0, exp.files);
470469
git_diff_free(diff);
471470

472-
cl_git_pass(git_repository_init(&r2, "empty_standard_repo/subrepo", 0));
471+
{
472+
git_repository *r2;
473+
cl_git_pass(git_repository_init(&r2, "empty_standard_repo/subrepo", 0));
474+
git_repository_free(r2);
475+
}
473476

474477
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
475478
memset(&exp, 0, sizeof(exp));

0 commit comments

Comments
 (0)