Commit 39b1ad7f by nulltoken

Plug configuration file search paths leaks

parent 74e06c05
...@@ -618,7 +618,7 @@ static git_futils_dirs_guess_cb git_futils__dir_guess[GIT_FUTILS_DIR__MAX] = { ...@@ -618,7 +618,7 @@ static git_futils_dirs_guess_cb git_futils__dir_guess[GIT_FUTILS_DIR__MAX] = {
git_futils_guess_template_dirs, git_futils_guess_template_dirs,
}; };
static void git_futils_dirs_global_shutdown(void) void git_futils_dirs_global_shutdown(void)
{ {
int i; int i;
for (i = 0; i < GIT_FUTILS_DIR__MAX; ++i) for (i = 0; i < GIT_FUTILS_DIR__MAX; ++i)
......
...@@ -399,4 +399,9 @@ extern int git_futils_filestamp_check( ...@@ -399,4 +399,9 @@ extern int git_futils_filestamp_check(
extern void git_futils_filestamp_set( extern void git_futils_filestamp_set(
git_futils_filestamp *tgt, const git_futils_filestamp *src); git_futils_filestamp *tgt, const git_futils_filestamp *src);
/**
* Free the configuration file search paths.
*/
extern void git_futils_dirs_global_shutdown(void);
#endif /* INCLUDE_fileops_h__ */ #endif /* INCLUDE_fileops_h__ */
...@@ -46,6 +46,8 @@ void test_repo_config__open_missing_global(void) ...@@ -46,6 +46,8 @@ void test_repo_config__open_missing_global(void)
git_config_free(global); git_config_free(global);
git_config_free(config); git_config_free(config);
git_repository_free(repo); git_repository_free(repo);
git_futils_dirs_global_shutdown();
} }
void test_repo_config__open_missing_global_with_separators(void) void test_repo_config__open_missing_global_with_separators(void)
...@@ -73,6 +75,8 @@ void test_repo_config__open_missing_global_with_separators(void) ...@@ -73,6 +75,8 @@ void test_repo_config__open_missing_global_with_separators(void)
git_config_free(global); git_config_free(global);
git_config_free(config); git_config_free(config);
git_repository_free(repo); git_repository_free(repo);
git_futils_dirs_global_shutdown();
} }
#include "repository.h" #include "repository.h"
...@@ -101,6 +105,8 @@ void test_repo_config__read_no_configs(void) ...@@ -101,6 +105,8 @@ void test_repo_config__read_no_configs(void)
cl_assert_equal_i(GIT_ABBREV_DEFAULT, val); cl_assert_equal_i(GIT_ABBREV_DEFAULT, val);
git_repository_free(repo); git_repository_free(repo);
git_futils_dirs_global_shutdown();
/* with just system */ /* with just system */
cl_must_pass(p_mkdir("alternate/1", 0777)); cl_must_pass(p_mkdir("alternate/1", 0777));
...@@ -197,4 +203,6 @@ void test_repo_config__read_no_configs(void) ...@@ -197,4 +203,6 @@ void test_repo_config__read_no_configs(void)
cl_assert(!git_path_exists("empty_standard_repo/.git/config")); cl_assert(!git_path_exists("empty_standard_repo/.git/config"));
cl_assert(!git_path_exists("alternate/3/.gitconfig")); cl_assert(!git_path_exists("alternate/3/.gitconfig"));
git_futils_dirs_global_shutdown();
} }
...@@ -322,6 +322,8 @@ void test_repo_open__no_config(void) ...@@ -322,6 +322,8 @@ void test_repo_open__no_config(void)
git_config_free(config); git_config_free(config);
git_repository_free(repo); git_repository_free(repo);
cl_fixture_cleanup("empty_standard_repo"); cl_fixture_cleanup("empty_standard_repo");
git_futils_dirs_global_shutdown();
} }
void test_repo_open__force_bare(void) void test_repo_open__force_bare(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment