diff options
| author | Russell Belfer <arrbee@arrbee.com> | 2012-01-05 15:15:43 -0800 |
|---|---|---|
| committer | Russell Belfer <arrbee@arrbee.com> | 2012-01-05 15:15:43 -0800 |
| commit | fa3cb0dae079f0f0d4b3f7e6e5eb560627e97eac (patch) | |
| tree | 1f19223699a3e5cfdee187992e6e0977ee1b5431 /src/index.c | |
| parent | 2d8405025d2037ab5d474b5bb5fbff7b346adce2 (diff) | |
| download | libgit2-fa3cb0dae079f0f0d4b3f7e6e5eb560627e97eac.tar.gz | |
Fix memory leak in git_index_remove.
Missed freeing the entry.
Diffstat (limited to 'src/index.c')
| -rw-r--r-- | src/index.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/index.c b/src/index.c index 9f9a08f0d..9e88012bb 100644 --- a/src/index.c +++ b/src/index.c @@ -510,6 +510,7 @@ int git_index_append2(git_index *index, const git_index_entry *source_entry) int git_index_remove(git_index *index, int position) { + int error; git_index_entry *entry; git_vector_sort(&index->entries); @@ -517,7 +518,12 @@ int git_index_remove(git_index *index, int position) if (entry != NULL) git_tree_cache_invalidate_path(index->tree, entry->path); - return git_vector_remove(&index->entries, (unsigned int)position); + error = git_vector_remove(&index->entries, (unsigned int)position); + + if (error == GIT_SUCCESS) + index_entry_free(entry); + + return error; } int git_index_find(git_index *index, const char *path) |
