Skip to content

Commit

Permalink
Memory Leak fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
SyedMIrtazaHyder committed Aug 24, 2024
1 parent b90e118 commit 7a0a8aa
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,14 @@ Node* __delete(Node *node,int data,bool &ok)

if(red(node)) /// the node is red => just delete it
{
free(node);
ok = true;
}
else if(red(temp)) /// only child is red => replace with that red child and recolor black . so , black balance restored
{
temp->color = BLACK;
free(node);
ok = true;
}
free(node);

return temp;
}
Expand Down

0 comments on commit 7a0a8aa

Please sign in to comment.