Fixed hashmap memory deallocation

Original hashmap_free would leak memory when cleaning buckets with
collisions. This version fixes that.