From: Andre Noll Date: Fri, 6 Sep 2013 23:21:44 +0000 (+0000) Subject: btr: splice-out fix. X-Git-Tag: v0.5.1~13^2~2 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=04d97d1a3a811a2e7eec75da093afdbc4045956c;p=paraslash.git btr: splice-out fix. When splicing out a node we set the ->parent pointer of all child nodes to the parent of the given node, and move each child to the ->children list of the parent. Except when there is no parent. If the given node was a root node (or an internal node whose parent vanished), we leave the ->children list untouched. In this case the assertion a few lines later triggers and aborts the program. Fix this by removing the nodes from the list. Such nodes have become root nodes themselves, so they should not be on any list of children. --- diff --git a/buffer_tree.c b/buffer_tree.c index fd0a59ca..aa9f1cdb 100644 --- a/buffer_tree.c +++ b/buffer_tree.c @@ -856,6 +856,8 @@ void btr_splice_out_node(struct btr_node *btrn) ch->parent = btrn->parent; if (btrn->parent) list_move(&ch->node, &btrn->parent->children); + else + list_del(&ch->node); } assert(list_empty(&btrn->children)); btrn->parent = NULL;