summaryrefslogtreecommitdiff
path: root/src/st.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2020-11-08 10:58:36 +0100
committerJörg Frings-Fürst <debian@jff.email>2020-11-08 10:58:36 +0100
commitb4158caf13bc715096c1df7c040c9d25995d76f2 (patch)
treea07d7d0764a8488f4b5ebef1561e2f3d8caacc05 /src/st.c
parent0f259c3073f341c48468e80e93731daa31698030 (diff)
parentfc9ba4264eafbb5a6ec0f3cc4cd2e1964c9b8fcf (diff)
Update upstream source from tag 'upstream/6.9.6'
Update to upstream version '6.9.6' with Debian dir 111ba939e0875272a460014bdcf030d413ce8f3f
Diffstat (limited to 'src/st.c')
-rw-r--r--src/st.c8
1 files changed, 6 insertions, 2 deletions
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 ;