htable: add optional free_cb to htable_clear()

This cb allows to free elements in a htable during cleanup. Simply iterate
all elements before destroying the table.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>