summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Kelley <phkelley@hotmail.com>2014-05-15 11:09:49 -0400
committerPhilip Kelley <phkelley@hotmail.com>2014-05-15 11:09:49 -0400
commit4af0ef9690e9fdfc81afbeed7039d02a5f191001 (patch)
tree4f61933de48d61e96886c3808a458f6fd997547a
parent7851e595ad832b532e6edc6ac5fb0e43db24fc6a (diff)
downloadlibgit2-4af0ef9690e9fdfc81afbeed7039d02a5f191001.tar.gz
Fix mutex init/free in config_file.c
-rw-r--r--src/config_file.c5
1 files changed, 4 insertions, 1 deletions
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;