aboutsummaryrefslogtreecommitdiff
path: root/src/common/libalgo/hashtbl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/libalgo/hashtbl.c')
-rw-r--r--src/common/libalgo/hashtbl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common/libalgo/hashtbl.c b/src/common/libalgo/hashtbl.c
index 6fb5b60..0284d75 100644
--- a/src/common/libalgo/hashtbl.c
+++ b/src/common/libalgo/hashtbl.c
@@ -67,7 +67,7 @@ void hashtbl_check_size(hashtbl_t *ht) {
if (4 * ht->nitems < ht->size) nsize = ht->size / 2;
if (4 * ht->nitems > 3 * ht->size) nsize = ht->size * 2;
- if (nsize != 0) {
+ if (nsize != 0 && nsize >= DEFAULT_HT_INIT_SIZE) {
hashtbl_item_t **nitems = (hashtbl_item_t**)malloc(nsize * sizeof(hashtbl_item_t*));
if (nitems == 0) return; // if we can't realloc, too bad, we just lose space/efficienty