mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05:00
Deletion case 2c can shift the root; case 3b is not the only case that
can do that. The bad case happens when you have a root node containing only one actual element, and its two child nodes have only one element each, and you try to delete the element in the root. [originally from svn r660]
This commit is contained in:
parent
4471e3fe6c
commit
4a2ea18a51
11
tree234.c
11
tree234.c
@ -569,6 +569,17 @@ void del234(tree234 *t, void *e) {
|
|||||||
}
|
}
|
||||||
n->elems[j] = NULL;
|
n->elems[j] = NULL;
|
||||||
n->kids[j+1] = NULL;
|
n->kids[j+1] = NULL;
|
||||||
|
/*
|
||||||
|
* It's possible, in this case, that we've just removed
|
||||||
|
* the only element in the root of the tree. If so,
|
||||||
|
* shift the root.
|
||||||
|
*/
|
||||||
|
if (n->elems[0] == NULL) {
|
||||||
|
LOG((" shifting root!\n"));
|
||||||
|
t->root = a;
|
||||||
|
a->parent = NULL;
|
||||||
|
sfree(n);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Now go round the deletion process again, with n
|
* Now go round the deletion process again, with n
|
||||||
* pointing at the new big node and e still the same.
|
* pointing at the new big node and e still the same.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user