Fix a memory leak in the hash table.

The linked list was not getting freed completely. Need to duplicate the
free code from the linked list because a custom function is needed to
free the user data stored in the hashtable and a custom function is
needed to free the struct stored in the linked list, while the linked
list's free function can take only one function pointer parameter.

Not sure how to make it more generic. Perhaps allowing the free function
of the linked list's free function to accept any number of arguments and
also make the free function varadic, pass all the extra arguments to the
function pointer.