mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-21 20:14:44 +00:00
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>
This commit is contained in:
parent
e822508a05
commit
cb77ad0d4e
@ -329,6 +329,8 @@ git_revwalk_commit *git_revwalk_list_pop_back(git_revwalk_list *list)
|
|||||||
list->tail = list->tail->prev;
|
list->tail = list->tail->prev;
|
||||||
if (list->tail == NULL)
|
if (list->tail == NULL)
|
||||||
list->head = NULL;
|
list->head = NULL;
|
||||||
|
else
|
||||||
|
list->tail->next = NULL;
|
||||||
|
|
||||||
commit = node->walk_commit;
|
commit = node->walk_commit;
|
||||||
free(node);
|
free(node);
|
||||||
@ -350,6 +352,8 @@ git_revwalk_commit *git_revwalk_list_pop_front(git_revwalk_list *list)
|
|||||||
list->head = list->head->next;
|
list->head = list->head->next;
|
||||||
if (list->head == NULL)
|
if (list->head == NULL)
|
||||||
list->tail = NULL;
|
list->tail = NULL;
|
||||||
|
else
|
||||||
|
list->head->prev = NULL;
|
||||||
|
|
||||||
commit = node->walk_commit;
|
commit = node->walk_commit;
|
||||||
free(node);
|
free(node);
|
||||||
|
Loading…
Reference in New Issue
Block a user