Use proper allocation size in hash_flush call to mush_realloc()
authorAri Johnson <ari@theari.com>
Tue, 26 Apr 2011 17:26:13 +0000 (13:26 -0400)
committerAri Johnson <ari@theari.com>
Tue, 26 Apr 2011 17:26:13 +0000 (13:26 -0400)
fixes #235

src/cque.c
src/htab.c

index ed57eb7ce41d7e8eaec3c2c3b11afa9ba6d3fa96..baa44af532d018039b2a3b24aae55c7054735bcd 100644 (file)
@@ -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
index 3f749956e56f3414eb011e7a6f92ceec7ad4732b..7c4bb3da07b90f3c3ce747676b7bf511b6741b22 100644 (file)
@@ -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;