Skip to content

Commit

Permalink
🔒️ fix unprotected malloc
Browse files Browse the repository at this point in the history
  • Loading branch information
tmatis committed Nov 5, 2023
1 parent 8c38108 commit 3fb5dbc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libft/srcs/rbtree/ft_rbtree_insert.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ ft_rbtree_node_t *ft_rbtree_insert(ft_rbtree_t *tree, void *value)
if (tree->root == NULL)
{
tree->root = new_node(value, tree->value_size, NULL);
if (tree->root == NULL)
return NULL;
tree->root->color = RBT_BLACK;
tree->node_count++;
return tree->root;
Expand Down

0 comments on commit 3fb5dbc

Please sign in to comment.