Added null pointer check to avltree constructor

This commit is contained in:
2023-09-07 00:54:28 -05:00
parent 08db5fe1f7
commit 365272e360

View File

@@ -5,10 +5,13 @@
struct avltree_t *avl_new(int key, void *value)
{
struct avltree_t *new_tree = kmalloc(sizeof(struct avltree_t));
if(new_tree != NULL)
{
new_tree->height = 1;
new_tree->left = new_tree->right = NULL;
new_tree->key = key;
new_tree->value = value;
}
return new_tree;
}