Opened 7 years ago
Closed 7 years ago
#1531 closed defect (invalid)
ngx_rbtree.h
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | other | Version: | 1.13.x |
Keywords: | Cc: | ||
uname -a: | Linux lwp-All-Series 4.10.0-19-generic #21-Ubuntu SMP Thu Apr 6 17:04:57 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux | ||
nginx -V: | nginx-1.12.2 |
Description
in ngx_rbtree.h
in function ngx_rbtree_min()
static ngx_inline ngx_rbtree_node_t *
ngx_rbtree_min(ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel)
{
while (node->left != sentinel)
{
node = node->left;
}
return node;
}
after delete all node, when call ngx_rbtree_min(tree->root, tree->sentinel) casue Segment error.
should be fix like this:
static inline ngx_rbtree_node_t *
ngx_rbtree_min(ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel)
{
while (node != sentinel && node->left != sentinel)
{
node = node->left;
}
if (node == sentinel)
{
return NULL;
}
return node;
}
You shouldn't call
ngx_rbtree_min()
on an empty tree. Seengx_event_find_timer()
orngx_event_expire_timers()
insrc/event/ngx_event_timer.c
for usage examples.