summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Coup <robert@coup.net.nz>2019-06-10 10:52:01 +0100
committerRobert Coup <robert@coup.net.nz>2019-06-10 11:22:02 +0100
commit438c99587ea39a0a1a1dac4888300137ffea3ba1 (patch)
tree11740a4877f175541396c76e8bc298fc03e2d67c
parent21ddeabe6cb4a77899a6c7348493a2b45cc82a9c (diff)
downloadlibgit2-438c99587ea39a0a1a1dac4888300137ffea3ba1.tar.gz
Fix memleaks in analysis tests.
Wrap some missed setup api calls in asserts.
-rw-r--r--tests/merge/analysis.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/merge/analysis.c b/tests/merge/analysis.c
index 504e4927a..b3c7b0326 100644
--- a/tests/merge/analysis.c
+++ b/tests/merge/analysis.c
@@ -114,7 +114,7 @@ void testimpl_merge_analysis__unborn(void)
git_merge_preference_t merge_pref;
git_buf master = GIT_BUF_INIT;
- git_buf_joinpath(&master, git_repository_path(repo), "refs/heads/master");
+ cl_git_pass(git_buf_joinpath(&master, git_repository_path(repo), "refs/heads/master"));
p_unlink(git_buf_cstr(&master));
analysis_from_branch(&merge_analysis, &merge_pref, NULL, NOFASTFORWARD_BRANCH);
@@ -129,13 +129,15 @@ void testimpl_merge_analysis__fastforward_with_config_noff(void)
git_merge_analysis_t merge_analysis;
git_merge_preference_t merge_pref;
- git_repository_config(&config, repo);
- git_config_set_string(config, "merge.ff", "false");
+ cl_git_pass(git_repository_config(&config, repo));
+ cl_git_pass(git_config_set_string(config, "merge.ff", "false"));
analysis_from_branch(&merge_analysis, &merge_pref, NULL, FASTFORWARD_BRANCH);
cl_assert_equal_i(GIT_MERGE_ANALYSIS_NORMAL|GIT_MERGE_ANALYSIS_FASTFORWARD, merge_analysis);
cl_assert_equal_i(GIT_MERGE_PREFERENCE_NO_FASTFORWARD, (merge_pref & GIT_MERGE_PREFERENCE_NO_FASTFORWARD));
+
+ git_config_free(config);
}
void testimpl_merge_analysis__no_fastforward_with_config_ffonly(void)
@@ -144,13 +146,15 @@ void testimpl_merge_analysis__no_fastforward_with_config_ffonly(void)
git_merge_analysis_t merge_analysis;
git_merge_preference_t merge_pref;
- git_repository_config(&config, repo);
- git_config_set_string(config, "merge.ff", "only");
+ cl_git_pass(git_repository_config(&config, repo));
+ cl_git_pass(git_config_set_string(config, "merge.ff", "only"));
analysis_from_branch(&merge_analysis, &merge_pref, NULL, NOFASTFORWARD_BRANCH);
cl_assert_equal_i(GIT_MERGE_ANALYSIS_NORMAL, merge_analysis);
cl_assert_equal_i(GIT_MERGE_PREFERENCE_FASTFORWARD_ONLY, (merge_pref & GIT_MERGE_PREFERENCE_FASTFORWARD_ONLY));
+
+ git_config_free(config);
}
void testimpl_merge_analysis__between_uptodate_refs(void)