Merge branch 'collectd-5.4' into collectd-5.5
[collectd.git] / src / daemon / utils_avltree.c
index da793b3..58b8b84 100644 (file)
@@ -146,6 +146,9 @@ static c_avl_node_t *rotate_right (c_avl_tree_t *t, c_avl_node_t *x)
        c_avl_node_t *y;
        c_avl_node_t *b;
 
+       assert (x != NULL);
+       assert (x->left != NULL);
+
        p = x->parent;
        y = x->left;
        b = y->right;
@@ -170,7 +173,7 @@ static c_avl_node_t *rotate_right (c_avl_tree_t *t, c_avl_node_t *x)
        y->height = calc_height (y);
 
        return (y);
-} /* void rotate_left */
+} /* void rotate_right */
 
 /*
  *    (x)                   (y)
@@ -187,6 +190,9 @@ static c_avl_node_t *rotate_left (c_avl_tree_t *t, c_avl_node_t *x)
        c_avl_node_t *y;
        c_avl_node_t *b;
 
+       assert (x != NULL);
+       assert (x->right != NULL);
+
        p = x->parent;
        y = x->right;
        b = y->left;
@@ -646,6 +652,7 @@ int c_avl_pick (c_avl_tree_t *t, void **key, void **value)
        *value = n->value;
 
        free_node (n);
+       --t->size;
        rebalance (t, p);
 
        return (0);