diff options
| author | Vicent Marti <tanoku@gmail.com> | 2011-02-18 12:23:53 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2011-02-18 12:23:53 +0200 |
| commit | cb77ad0d4e66262393c3fa868a7bc723cfd71d61 (patch) | |
| tree | 7c8dbd8aeb8eedce57565f6f3a27842dbc0bdde1 /src/revwalk.c | |
| parent | e822508a055a7d46dc0b9aa06fbc1a49515201c8 (diff) | |
| download | libgit2-cb77ad0d4e66262393c3fa868a7bc723cfd71d61.tar.gz | |
Fix segfault when iterating a revlist backwards
The `prev` and `next` pointers were not being updated after popping one
of the list elements.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/revwalk.c')
| -rw-r--r-- | src/revwalk.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/revwalk.c b/src/revwalk.c index 2237e333d..e30e543a8 100644 --- a/src/revwalk.c +++ b/src/revwalk.c @@ -329,6 +329,8 @@ git_revwalk_commit *git_revwalk_list_pop_back(git_revwalk_list *list) list->tail = list->tail->prev; if (list->tail == NULL) list->head = NULL; + else + list->tail->next = NULL; commit = node->walk_commit; free(node); @@ -350,6 +352,8 @@ git_revwalk_commit *git_revwalk_list_pop_front(git_revwalk_list *list) list->head = list->head->next; if (list->head == NULL) list->tail = NULL; + else + list->head->prev = NULL; commit = node->walk_commit; free(node); |
