From 2dc835cc5df01d2077993e05e474a716f19110da Mon Sep 17 00:00:00 2001 From: Ari Johnson Date: Tue, 26 Apr 2011 13:26:13 -0400 Subject: [PATCH] Use proper allocation size in hash_flush call to mush_realloc() fixes #235 --- src/cque.c | 6 ++---- src/htab.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) 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; -- 2.30.2