From 2da298caaa26dc373a11f193a55572fd1c863b1f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Fri, 8 Aug 2014 19:49:57 +0200
Subject: [PATCH] Mappings: Fixed assertion.

Ensure that there are at least as many keypairs as buckets in
created mappings.

Fixes fatal "Pretty mean hashtable there buster!".
---
 src/mapping.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mapping.c b/src/mapping.c
index ddc9fecd67..534a148aeb 100644
--- a/src/mapping.c
+++ b/src/mapping.c
@@ -197,6 +197,8 @@ static void init_mapping(struct mapping *m,
   {
     hashsize=find_next_power(size / AVG_LINK_LENGTH + 1);
 
+    if (size < hashsize) size = hashsize;
+
     e=MAPPING_DATA_SIZE(hashsize, size);
 
     md=xcalloc(1,e);
-- 
GitLab