From: Rick L Bird Date: Tue, 10 May 2011 08:54:40 +0000 (-0400) Subject: PennMUSH 1.8.3p12 X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=af834c6396a7355af5b9b47e145cec50de3d05a5;p=cobramush.git PennMUSH 1.8.3p12 Author: allthecoolkidshaveone Date: Wed Jan 13 09:36:05 2010 +0000 Issue 88: Possible fix for the hash table crash bug. Fixes #235 --- diff --git a/src/htab.c b/src/htab.c index b0d1c36..0d8a347 100644 --- a/src/htab.c +++ b/src/htab.c @@ -612,14 +612,18 @@ hash_add(HASHTAB *htab, const char *key, void *hashdata) keycopy = mush_strdup(key, "hash.key"); - if (!hash_insert(htab, keycopy, hashdata)) { - first_offset = -1; - resize_calls = 0; - if (!real_hash_resize(htab, htab->hashsize, - (htab->hashfunc_offset + 1) % NHASH_MOD)) { - htab->entries -= 1; - return false; - } + + while (1) { + if (!hash_insert(htab, keycopy, hashdata)) { + first_offset = -1; + resize_calls = 0; + if (!real_hash_resize(htab, htab->hashsize, + (htab->hashfunc_offset + 1) % NHASH_MOD)) { + htab->entries -= 1; + return false; + } + } else + break; } return true; }