fix the leak that happens if krealloc fails

Make sure `new_flags` doesn't leak (i.e., gets freed) if either of the `krealloc`s fails when resizing a hash table.