From fc9ba4264eafbb5a6ec0f3cc4cd2e1964c9b8fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 8 Nov 2020 10:58:30 +0100 Subject: New upstream version 6.9.6 --- src/st.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/st.c') diff --git a/src/st.c b/src/st.c index 522f205..8ee610b 100644 --- a/src/st.c +++ b/src/st.c @@ -151,6 +151,7 @@ st_init_table_with_size(type, size) #endif size = new_size(size); /* round up to prime number */ + if (size <= 0) return 0; tbl = alloc(st_table); if (tbl == 0) return 0; @@ -318,10 +319,13 @@ rehash(table) register st_table *table; { register st_table_entry *ptr, *next, **new_bins; - int i, old_num_bins = table->num_bins, new_num_bins; + int i, new_num_bins, old_num_bins; unsigned int hash_val; - new_num_bins = new_size(old_num_bins+1); + old_num_bins = table->num_bins; + new_num_bins = new_size(old_num_bins + 1); + if (new_num_bins <= 0) return ; + new_bins = (st_table_entry**)Calloc(new_num_bins, sizeof(st_table_entry*)); if (new_bins == 0) { return ; -- cgit v1.2.3