- hash->values = xrealloc(hash->values, n * sizeof *hash->values);
- if(n > hash->n)
- memset(hash->values + hash->n, 0, (n - hash->n) * sizeof *hash->values);
+ hash->values = xrealloc(hash->values, n * sizeof(*hash->values));
+
+ if(n > hash->n) {
+ memset(hash->keys + hash->n * hash->size, 0, (n - hash->n) * hash->size);
+ memset(hash->values + hash->n, 0, (n - hash->n) * sizeof(*hash->values));
+ }