It looks like my unload function is not working properly. Valgrind shows 0 errors, but when I print out the address of my root node, it is not NULL. Hence my unload function (which returns true if root == NULL) does not return true.
If I try to manually free the root node, I get an invalid free error instead:
Address 0x51fc2c0 is 0 bytes inside a block of size 224 free'd.
I have implemented my root node as a node* and not a separate struct, if that matters.
Does anyone know what I did wrong? If you need any more info to help troubleshoot the problem, please let me know.
EDIT: Ok so I realised that after you free the nodes, the addresses are still there (correct me if I'm wrong), so I'll have to figure out some other way for my unload function to return true.