Initializtion
This commit is contained in:
parent
bcf92ad070
commit
65f1c89f27
@ -29,6 +29,10 @@ node_t *build_tree(int *tree_data, size_t tree_data_len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
current = malloc(sizeof(node_t));
|
current = malloc(sizeof(node_t));
|
||||||
|
if (current == NULL) {
|
||||||
|
free_tree(root);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
current->data = tree_data[i];
|
current->data = tree_data[i];
|
||||||
current->left = NULL;
|
current->left = NULL;
|
||||||
current->right = NULL;
|
current->right = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user