1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

add guards for NULL dereference

svn path=/icecast/trunk/avl/; revision=13799
This commit is contained in:
Karl Heyes 2007-09-14 03:09:32 +00:00
parent e99eee6c80
commit 7735a94ee6

View File

@ -822,14 +822,14 @@ avl_get_span_by_key (avl_tree * tree,
/* search left */
left = avl_get_prev (node);
i = m;
while ((i > 0) && (tree->compare_fun (tree->compare_arg, key, left->key) == 0)) {
while (left && (i > 0) && (tree->compare_fun (tree->compare_arg, key, left->key) == 0)) {
left = avl_get_prev (left);
i = i - 1;
}
/* search right */
right = avl_get_next (node);
j = m;
while ((j <= tree->length) && (tree->compare_fun (tree->compare_arg, key, right->key) == 0)) {
while (right && (j <= tree->length) && (tree->compare_fun (tree->compare_arg, key, right->key) == 0)) {
right = avl_get_next (right);
j = j + 1;
}
@ -870,7 +870,7 @@ avl_get_span_by_two_keys (avl_tree * tree,
avl_node * left;
/* search left */
left = avl_get_prev (low_node);
while ((i > 0) && (tree->compare_fun (tree->compare_arg, low_key, left->key) == 0)) {
while (left && (i > 0) && (tree->compare_fun (tree->compare_arg, low_key, left->key) == 0)) {
left = avl_get_prev (left);
i = i - 1;
}
@ -881,7 +881,7 @@ avl_get_span_by_two_keys (avl_tree * tree,
avl_node * right;
/* search right */
right = avl_get_next (high_node);
while ((j <= tree->length) && (tree->compare_fun (tree->compare_arg, high_key, right->key) == 0)) {
while (right && (j <= tree->length) && (tree->compare_fun (tree->compare_arg, high_key, right->key) == 0)) {
right = avl_get_next (right);
j = j + 1;
}