Segfault in NGINX - testcase

double nginx-forum at nginx.us
Sat Mar 20 11:43:56 MSK 2010


Hello,

The root node of the nginx-rbtree is *always* NULL, because
"ngx_rbtree_insert()" provides that feature. Only if the rbtree
has 2 elements and you delete the root node, then "parent" of the
root-node points to the deleted element. Why not fixing it?

Thank you very much
Marcus


The corresponding code:

void ngx_rbtree_insert(ngx_thread_volatile ngx_rbtree_t *tree, ngx_rbtree_node_t *node)
{
    [....]
    if (*root == sentinel) {
        node->parent = NULL;
        node->left = sentinel;
        node->right = sentinel;
        ngx_rbt_black(node);
        *root = node;

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,65693,65847#msg-65847




More information about the nginx mailing list