]> git.sur5r.net Git - openldap/commitdiff
Fix end conditions for tavl_end and tavl_next
authorHoward Chu <hyc@openldap.org>
Fri, 23 Sep 2005 06:25:13 +0000 (06:25 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 23 Sep 2005 06:25:13 +0000 (06:25 +0000)
libraries/liblutil/tavl.c

index d2a4ccf4285c92a31d7c03606826b27b480e9256..9a7c9a31f271e68c576ae1a815b650984428dd07 100644 (file)
@@ -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];
                }
        }