Fix user after free in hash implementation.

Fix comes from Lukas Anzinger and has been commited in kmod as
86e19e9acd62e5729fa66e850fd13df991ae7fca.  His words: "If a value is added
to the hash under a key that already exists the new value replaces the old
value for that key.  Since key can be a pointer to data that is part of
value and freed by hash->free_value(), the key must be also replaced and not
only the value.  Otherwise key potentially points to freed data."