I have no idea what I'm doing

This commit is contained in:
Václav Šmejkal 2023-02-01 16:10:51 +01:00
parent d1b3960799
commit f405c486c8
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -66,15 +66,16 @@ void remove_node(node_t *node) //valgrind says this causes memory leaks ('still
if (node -> next != NULL)
{
node -> next -> last = node -> last;
} else if (node -> last != NULL)
} else
{
node -> last -> next = NULL;
}
if (head -> next == NULL) //LIST IS EMPTY NOW => DEALLOCATE
{
free(head);
head = NULL;
if (node -> last != NULL)
{
node -> last -> next = NULL;
} else //LIST IS EMPTY NOW => DEALLOCATE
{
free(head);
head = NULL;
}
}
//DEALLOCATION