Fix rare case of wmem map being O(n)

For 'x' equal to 0, HASH() macro also returns 0 which makes wmem map O(n).
When random generator will return 0 just use 1.

Change-Id: If484091352a719aea27135a705d37ff4c184a13b
Reviewed-on: https://code.wireshark.org/review/1387
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2014-04-27 17:54:32 -04:00
parent 4272cb8786
commit 98ed927290
1 changed files with 2 additions and 0 deletions

View File

@ -36,6 +36,8 @@ void
wmem_init_hashing(void)
{
x = g_random_int();
if (G_UNLIKELY(x == 0))
x = 1;
preseed = g_random_int();
postseed = g_random_int();