I have no idea what I'm doing
This commit is contained in:
parent
d1b3960799
commit
f405c486c8
@ -66,16 +66,17 @@ void remove_node(node_t *node) //valgrind says this causes memory leaks ('still
|
|||||||
if (node -> next != NULL)
|
if (node -> next != NULL)
|
||||||
{
|
{
|
||||||
node -> next -> last = node -> last;
|
node -> next -> last = node -> last;
|
||||||
} else if (node -> last != NULL)
|
} else
|
||||||
|
{
|
||||||
|
if (node -> last != NULL)
|
||||||
{
|
{
|
||||||
node -> last -> next = NULL;
|
node -> last -> next = NULL;
|
||||||
}
|
} else //LIST IS EMPTY NOW => DEALLOCATE
|
||||||
|
|
||||||
if (head -> next == NULL) //LIST IS EMPTY NOW => DEALLOCATE
|
|
||||||
{
|
{
|
||||||
free(head);
|
free(head);
|
||||||
head = NULL;
|
head = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//DEALLOCATION
|
//DEALLOCATION
|
||||||
free(node);
|
free(node);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user