Skip to content

Commit

Permalink
fix(binary_search_tree.c): Fix unreleased memory
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonglja committed Jan 2, 2024
1 parent ff5db90 commit 4fba7c5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions codes/c/chapter_tree/binary_search_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ void removeItem(BinarySearchTree *bst, int num) {
} else {
pre->right = child;
}
// 释放内存
free(cur);
} else {
/* 子节点数量 = 2 */
// 获取中序遍历中 cur 的下一个节点
Expand Down

0 comments on commit 4fba7c5

Please sign in to comment.