diff options
author | Vicent Marti <vicent@github.com> | 2014-03-27 23:40:28 +0100 |
---|---|---|
committer | Vicent Marti <vicent@github.com> | 2014-03-27 23:40:28 +0100 |
commit | 04d4d674fe0ccd6cc29f30359b8306c5b3feae3d (patch) | |
tree | aa0ec0ba4293f5e11d68e16d14ff0de2e8148f85 /tests/diff/submodules.c | |
parent | 041fad4aac106650f00b7c445675f1c4bb8cfd53 (diff) | |
parent | dae8ba6e0968d3ace5ac3c2878fb2072f1db43ba (diff) | |
download | libgit2-04d4d674fe0ccd6cc29f30359b8306c5b3feae3d.tar.gz |
Merge pull request #2212 from libgit2/rb/submodule-use-after-free
Fix use-after-free in submodule reload code and other memory leaks
Diffstat (limited to 'tests/diff/submodules.c')
-rw-r--r-- | tests/diff/submodules.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/diff/submodules.c b/tests/diff/submodules.c index 80dfcaa3f..ead5c71b6 100644 --- a/tests/diff/submodules.c +++ b/tests/diff/submodules.c @@ -449,7 +449,6 @@ void test_diff_submodules__skips_empty_includes_used(void) git_diff_options opts = GIT_DIFF_OPTIONS_INIT; git_diff *diff = NULL; diff_expects exp; - git_repository *r2; /* A side effect of of Git's handling of untracked directories and * auto-ignoring of ".git" entries is that a newly initialized Git @@ -469,7 +468,11 @@ void test_diff_submodules__skips_empty_includes_used(void) cl_assert_equal_i(0, exp.files); git_diff_free(diff); - cl_git_pass(git_repository_init(&r2, "empty_standard_repo/subrepo", 0)); + { + git_repository *r2; + cl_git_pass(git_repository_init(&r2, "empty_standard_repo/subrepo", 0)); + git_repository_free(r2); + } cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts)); memset(&exp, 0, sizeof(exp)); |