free memory when unregistering an entry.