list: add function to free a list
gossip: add function to free node lists
list: fix some possible memory leaks in list implementation