mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-12 04:15:06 -05:00
Fix rare segfault on package removal
Very rarely a segfault would occur when removing a number of packages due to a corrupted list for the local database (FS#27805, FS#28195). This was caused by the alpm_list_msort function not correctly dealing with the two new head node's prev values. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
9d1e8084df
commit
fcbae69fe8
@ -279,8 +279,11 @@ alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, size_t n, alpm_list_fn
|
||||
alpm_list_t *left = list;
|
||||
alpm_list_t *lastleft = alpm_list_nth(list, n/2 - 1);
|
||||
alpm_list_t *right = lastleft->next;
|
||||
/* terminate first list */
|
||||
|
||||
/* tidy new lists */
|
||||
lastleft->next = NULL;
|
||||
right->prev = left->prev;
|
||||
left->prev = lastleft;
|
||||
|
||||
left = alpm_list_msort(left, n/2, fn);
|
||||
right = alpm_list_msort(right, n - (n/2), fn);
|
||||
|
Loading…
Reference in New Issue
Block a user