summaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/config.c b/src/config.c
index 4e48ff7f4..a8e15405b 100644
--- a/src/config.c
+++ b/src/config.c
@@ -22,15 +22,12 @@ typedef struct {
int priority;
} file_internal;
-void git_config_free(git_config *cfg)
+static void config_free(git_config *cfg)
{
unsigned int i;
git_config_file *file;
file_internal *internal;
- if (cfg == NULL)
- return;
-
for(i = 0; i < cfg->files.length; ++i){
internal = git_vector_get(&cfg->files, i);
file = internal->file;
@@ -42,6 +39,14 @@ void git_config_free(git_config *cfg)
git__free(cfg);
}
+void git_config_free(git_config *cfg)
+{
+ if (cfg == NULL)
+ return;
+
+ GIT_REFCOUNT_DEC(cfg, config_free);
+}
+
static int config_backend_cmp(const void *a, const void *b)
{
const file_internal *bk_a = (const file_internal *)(a);
@@ -66,7 +71,7 @@ int git_config_new(git_config **out)
}
*out = cfg;
-
+ GIT_REFCOUNT_INC(cfg);
return GIT_SUCCESS;
}