Initializtion
This commit is contained in:
parent
bcf92ad070
commit
65f1c89f27
@ -25,10 +25,14 @@ node_t *build_tree(int *tree_data, size_t tree_data_len) {
|
|||||||
current = current->left;
|
current = current->left;
|
||||||
} else {
|
} else {
|
||||||
current = current->right;
|
current = current->right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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