summaryrefslogtreecommitdiff
path: root/src/index.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-10-28 14:51:13 -0700
committerVicent Marti <tanoku@gmail.com>2011-10-28 19:02:36 -0700
commit3286c408eccb18c525ca123383f3ebf5097441bc (patch)
tree4422fe16ab4f7b9cf713e0209cbb74fb4115889e /src/index.c
parentda37654d04617b4dacce6e7a4796007d2854624d (diff)
downloadlibgit2-3286c408eccb18c525ca123383f3ebf5097441bc.tar.gz
global: Properly use `git__` memory wrappers
Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/index.c b/src/index.c
index 7bf5daf2c..9ace9515f 100644
--- a/src/index.c
+++ b/src/index.c
@@ -138,7 +138,7 @@ static int index_initialize(git_index **index_out, git_repository *owner, const
index->index_file_path = git__strdup(index_path);
if (index->index_file_path == NULL) {
- free(index);
+ git__free(index);
return GIT_ENOMEM;
}
@@ -179,8 +179,8 @@ void git_index_free(git_index *index)
git_vector_free(&index->entries);
git_vector_free(&index->unmerged);
- free(index->index_file_path);
- free(index);
+ git__free(index->index_file_path);
+ git__free(index);
}
void git_index_clear(git_index *index)
@@ -192,15 +192,15 @@ void git_index_clear(git_index *index)
for (i = 0; i < index->entries.length; ++i) {
git_index_entry *e;
e = git_vector_get(&index->entries, i);
- free(e->path);
- free(e);
+ git__free(e->path);
+ git__free(e);
}
for (i = 0; i < index->unmerged.length; ++i) {
git_index_entry_unmerged *e;
e = git_vector_get(&index->unmerged, i);
- free(e->path);
- free(e);
+ git__free(e->path);
+ git__free(e);
}
git_vector_clear(&index->entries);
@@ -334,7 +334,7 @@ static int index_entry_init(git_index_entry **entry_out, git_index *index, const
entry->flags |= (stage << GIT_IDXENTRY_STAGESHIFT);
entry->path = git__strdup(rel_path);
if (entry->path == NULL) {
- free(entry);
+ git__free(entry);
return GIT_ENOMEM;
}
@@ -364,8 +364,8 @@ static void index_entry_free(git_index_entry *entry)
{
if (!entry)
return;
- free(entry->path);
- free(entry);
+ git__free(entry->path);
+ git__free(entry);
}
static int index_insert(git_index *index, git_index_entry *entry, int replace)
@@ -416,8 +416,8 @@ static int index_insert(git_index *index, git_index_entry *entry, int replace)
/* exists, replace it */
entry_array = (git_index_entry **) index->entries.contents;
- free(entry_array[position]->path);
- free(entry_array[position]);
+ git__free(entry_array[position]->path);
+ git__free(entry_array[position]);
entry_array[position] = entry;
return GIT_SUCCESS;