diff --git a/src/config_file.c b/src/config_file.c index fdc9bc8a2..56271144b 100644 --- a/src/config_file.c +++ b/src/config_file.c @@ -270,7 +270,6 @@ static int config_open(git_config_backend *cfg, git_config_level_t level) if ((res = refcounted_strmap_alloc(&b->header.values)) < 0) return res; - git_mutex_init(&b->header.values_mutex); git_array_init(b->readers); reader = git_array_alloc(b->readers); if (!reader) { @@ -375,6 +374,7 @@ static void backend_free(git_config_backend *_backend) git__free(backend->file_path); refcounted_strmap_free(backend->header.values); + git_mutex_free(&backend->header.values_mutex); git__free(backend); } @@ -686,6 +686,7 @@ int git_config_file__ondisk(git_config_backend **out, const char *path) GITERR_CHECK_ALLOC(backend); backend->header.parent.version = GIT_CONFIG_BACKEND_VERSION; + git_mutex_init(&backend->header.values_mutex); backend->file_path = git__strdup(path); GITERR_CHECK_ALLOC(backend->file_path); @@ -758,6 +759,7 @@ static void backend_readonly_free(git_config_backend *_backend) return; refcounted_strmap_free(backend->header.values); + git_mutex_free(&backend->header.values_mutex); git__free(backend); } @@ -784,6 +786,7 @@ int git_config_file__snapshot(git_config_backend **out, diskfile_backend *in) GITERR_CHECK_ALLOC(backend); backend->header.parent.version = GIT_CONFIG_BACKEND_VERSION; + git_mutex_init(&backend->header.values_mutex); backend->snapshot_from = in;