fix hashtable realloc memset range

This commit is contained in:
Andre Lorbach 2025-06-10 09:50:40 +02:00
parent e975ab99d7
commit 209213cadc

View File

@ -129,7 +129,8 @@ hashtable_expand(struct hashtable *h)
realloc(h->table, newsize * sizeof(struct entry *));
if (NULL == newtable) { (h->primeindex)--; return 0; }
h->table = newtable;
memset(newtable[h->tablelength], 0, newsize - h->tablelength);
memset(&newtable[h->tablelength], 0,
(newsize - h->tablelength) * sizeof(struct entry *));
for (i = 0; i < h->tablelength; i++) {
for (pE = &(newtable[i]), e = *pE; e != NULL; e = *pE) {
idx = indexFor(newsize,e->h);