aboutsummaryrefslogtreecommitdiff
path: root/src/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hash.c')
-rw-r--r--src/hash.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/hash.c b/src/hash.c
index a45ab54..a34e530 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -60,6 +60,8 @@ void *hash_init(size_t sz, unsigned (*hash_fn)(const void*),
int (*compare_keys)(const void*, const void*))
{
struct hash_map *ret = calloc(sizeof(struct hash_map), 1);
+ if(!sz)
+ sz = 1;
ret->table = calloc(sz, sizeof(struct hash_node*));
ret->table_sz = sz;
ret->hash = hash_fn;