From: Howard Chu Date: Fri, 23 Sep 2005 06:25:13 +0000 (+0000) Subject: Fix end conditions for tavl_end and tavl_next X-Git-Tag: OPENLDAP_REL_ENG_2_2_MP~395 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e840a34fef5bbf4487884434f8312ade4b101ce6;p=openldap Fix end conditions for tavl_end and tavl_next --- diff --git a/libraries/liblutil/tavl.c b/libraries/liblutil/tavl.c index d2a4ccf428..9a7c9a31f2 100644 --- a/libraries/liblutil/tavl.c +++ b/libraries/liblutil/tavl.c @@ -475,7 +475,7 @@ Avlnode * tavl_end( Avlnode *root, int dir ) { if ( root ) { - while ( root->avl_bits[dir] == AVL_CHILD ) + while ( root->avl_bits[dir] == AVL_CHILD && root->avl_link[dir] ) root = root->avl_link[dir]; } return root; @@ -491,7 +491,7 @@ tavl_next( Avlnode *root, int dir ) root = root->avl_link[dir]; if ( c == AVL_CHILD ) { dir ^= 1; - while ( root->avl_bits[dir] == AVL_CHILD ) + while ( root && root->avl_bits[dir] == AVL_CHILD ) root = root->avl_link[dir]; } }