diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2012-11-02 01:01:21 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2012-11-02 01:01:21 -0500 |
commit | 050cf8b8a691bd7e22b18e2bc330698e4b94bd2c (patch) | |
tree | 15b39fb820dc026ee1dbad386acc4964a0f416fc | |
parent | e30c052c4e46df9d8f929ab4f86f34718bb15a5d (diff) | |
download | libgit2-050cf8b8a691bd7e22b18e2bc330698e4b94bd2c.tar.gz |
freeing index entries would be helpful
-rw-r--r-- | src/index.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/index.c b/src/index.c index cb83015a6..214d29def 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; } |