Commit 4af0ef96 by Philip Kelley

Fix mutex init/free in config_file.c

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