Commit 979f75d8 by Vicent Marti

Refcounting

parent 4e6e2ff2
...@@ -86,7 +86,7 @@ int git_refdb_compress(git_refdb *db) ...@@ -86,7 +86,7 @@ int git_refdb_compress(git_refdb *db)
return 0; return 0;
} }
static void refdb_free(git_refdb *db) void git_refdb__free(git_refdb *db)
{ {
refdb_free_backend(db); refdb_free_backend(db);
git__free(db); git__free(db);
...@@ -97,7 +97,7 @@ void git_refdb_free(git_refdb *db) ...@@ -97,7 +97,7 @@ void git_refdb_free(git_refdb *db)
if (db == NULL) if (db == NULL)
return; return;
GIT_REFCOUNT_DEC(db, refdb_free); GIT_REFCOUNT_DEC(db, git_refdb__free);
} }
int git_refdb_exists(int *exists, git_refdb *refdb, const char *ref_name) int git_refdb_exists(int *exists, git_refdb *refdb, const char *ref_name)
...@@ -161,7 +161,7 @@ int git_refdb_iterator_next_name(const char **out, git_reference_iterator *iter) ...@@ -161,7 +161,7 @@ int git_refdb_iterator_next_name(const char **out, git_reference_iterator *iter)
void git_refdb_iterator_free(git_reference_iterator *iter) void git_refdb_iterator_free(git_reference_iterator *iter)
{ {
GIT_REFCOUNT_DEC(iter->db, refdb_free); GIT_REFCOUNT_DEC(iter->db, git_refdb__free);
iter->free(iter); iter->free(iter);
} }
......
...@@ -16,6 +16,8 @@ struct git_refdb { ...@@ -16,6 +16,8 @@ struct git_refdb {
git_refdb_backend *backend; git_refdb_backend *backend;
}; };
void git_refdb__free(git_refdb *db);
int git_refdb_exists( int git_refdb_exists(
int *exists, int *exists,
git_refdb *refdb, git_refdb *refdb,
......
...@@ -95,6 +95,9 @@ void git_reference_free(git_reference *reference) ...@@ -95,6 +95,9 @@ void git_reference_free(git_reference *reference)
if (reference->type == GIT_REF_SYMBOLIC) if (reference->type == GIT_REF_SYMBOLIC)
git__free(reference->target.symbolic); git__free(reference->target.symbolic);
if (reference->db)
GIT_REFCOUNT_DEC(reference->db, git_refdb__free);
git__free(reference); git__free(reference);
} }
......
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