coverity/62622: Fix use after free.

Problem: A reference to a hashtable's underlying array could become
stale if the array was freed and reallocated within a loop. The array
could be reallocated at the call to hash_remove(), line 3771.

Solution: Maintain a separate loop variable as an offset from the start
of the array so the pointer into the array will stay correct even if the
array is reallocated.