Commit f98bd08a authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

avoiding segmentation fault by access a null reference on a tree node, after...

avoiding segmentation fault by access a null reference on a tree node, after be removed by another worker
parent 3f46463f
...@@ -46,7 +46,7 @@ ngx_http_push_stream_find_channel_on_tree(ngx_str_t *id, ngx_log_t *log, ngx_rbt ...@@ -46,7 +46,7 @@ ngx_http_push_stream_find_channel_on_tree(ngx_str_t *id, ngx_log_t *log, ngx_rbt
node = tree->root; node = tree->root;
sentinel = tree->sentinel; sentinel = tree->sentinel;
while (node != sentinel) { while ((node != NULL) && (node != sentinel)) {
if (hash < node->key) { if (hash < node->key) {
node = node->left; node = node->left;
continue; continue;
...@@ -217,7 +217,7 @@ ngx_http_push_stream_rbtree_walker(ngx_rbtree_t *tree, ngx_slab_pool_t *shpool, ...@@ -217,7 +217,7 @@ ngx_http_push_stream_rbtree_walker(ngx_rbtree_t *tree, ngx_slab_pool_t *shpool,
ngx_rbtree_node_t *sentinel = tree->sentinel; ngx_rbtree_node_t *sentinel = tree->sentinel;
if (node != sentinel) { if ((node != NULL) && (node != sentinel)) {
apply((ngx_http_push_stream_channel_t *) node, shpool); apply((ngx_http_push_stream_channel_t *) node, shpool);
if (node->left != NULL) { if (node->left != NULL) {
ngx_http_push_stream_rbtree_walker(tree, shpool, apply, node->left); ngx_http_push_stream_rbtree_walker(tree, shpool, apply, node->left);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment