diff options
| author | Ben Straub <bs@github.com> | 2012-12-12 19:53:05 -0800 |
|---|---|---|
| committer | Ben Straub <bs@github.com> | 2012-12-12 19:53:05 -0800 |
| commit | ae0ddc6f024c52d8a4144b31ff122b922d72aeb4 (patch) | |
| tree | 2f26b871d9c03f7d554b6e9fd4ba1c95676a6579 | |
| parent | 6cacd44bd036e9987134a4f43fee33dc1acb447b (diff) | |
| parent | e759b0721718f99f515997c2e7c9c254b35741af (diff) | |
| download | libgit2-ae0ddc6f024c52d8a4144b31ff122b922d72aeb4.tar.gz | |
Merge pull request #1139 from ethomson/index_bugfix
don't walk off the end of the index
| -rw-r--r-- | src/index.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/index.c b/src/index.c index 1e5b28002..d4568aaef 100644 --- a/src/index.c +++ b/src/index.c @@ -957,13 +957,14 @@ int git_index_conflict_remove(git_index *index, const char *path) continue; } - error = git_vector_remove(&index->entries, (unsigned int)pos); + if ((error = git_vector_remove(&index->entries, (unsigned int)pos)) < 0) + return error; - if (error >= 0) - index_entry_free(conflict_entry); + index_entry_free(conflict_entry); + posmax--; } - return error; + return 0; } static int index_conflicts_match(const git_vector *v, size_t idx) |
