freeing index entries would be helpful
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
diff --git a/src/index.c b/src/index.c
index cb83015..214d29d 100644
--- a/src/index.c
+++ b/src/index.c
@@ -914,6 +914,7 @@ int git_index_conflict_remove(git_index *index, const char *path)
{
int pos;
git_index_entry *conflict_entry;
+ int error = 0;
assert(index && path);
@@ -931,18 +932,23 @@ int git_index_conflict_remove(git_index *index, const char *path)
continue;
}
- git_vector_remove(&index->entries, (unsigned int)pos);
+ error = git_vector_remove(&index->entries, (unsigned int)pos);
+
+ if (error >= 0)
+ index_entry_free(conflict_entry);
}
- return 0;
+ return error;
}
static int index_conflicts_match(git_vector *v, size_t idx)
{
git_index_entry *entry = git_vector_get(v, idx);
- if (index_entry_stage(entry) > 0)
+ if (index_entry_stage(entry) > 0) {
+ index_entry_free(entry);
return 1;
+ }
return 0;
}