From: Ari Johnson Date: Tue, 26 Apr 2011 17:26:13 +0000 (-0400) Subject: Use proper allocation size in hash_flush call to mush_realloc() X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=2dc835cc5df01d2077993e05e474a716f19110da;p=cobramush.git Use proper allocation size in hash_flush call to mush_realloc() fixes #235 --- diff --git a/src/cque.c b/src/cque.c index ed57eb7..baa44af 100644 --- a/src/cque.c +++ b/src/cque.c @@ -1971,8 +1971,7 @@ void free_namedregs(HASHTAB * regs) { clear_namedregs(regs); - /* FIXME: This crashes us on reboots */ - /* hashfree(regs); */ + hashfree(regs); } void @@ -1984,8 +1983,7 @@ clear_namedregs(HASHTAB * regs) value = (char *) hash_nextentry(regs)) mush_free(value, "namedreg"); - /* FIXME: This is crashign us for some reason.. */ - /* hashflush(regs, 16); */ + hashflush(regs, 16); } void diff --git a/src/htab.c b/src/htab.c index 3f74995..7c4bb3d 100644 --- a/src/htab.c +++ b/src/htab.c @@ -662,7 +662,7 @@ hash_flush(HASHTAB *htab, int size) } htab->entries = 0; size = next_prime_after(size); - resized = mush_realloc(htab->buckets, size, "hash.buckets"); + resized = mush_realloc(htab->buckets, size * sizeof(struct hash_bucket), "hash.buckets"); if (resized) { htab->buckets = resized; htab->hashsize = size;