]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Also use allochashtable in repo_rpmmd.c
authorMichael Schroeder <mls@suse.de>
Fri, 15 May 2026 08:52:22 +0000 (10:52 +0200)
committerMichael Schroeder <mls@suse.de>
Fri, 15 May 2026 08:52:22 +0000 (10:52 +0200)
Should have been in commit fa35e8672b478c410429d403b887277d7b17e57d

ext/repo_rpmmd.c

index 0255d91bc5d79670c3b0e16670bb169a509c0e61..e7498798df933ec3210839d3deb6da5be674749b 100644 (file)
@@ -521,7 +521,7 @@ rebuild_cshash(struct parsedata *pd)
   fprintf(stderr, "rebuild cshash with mask 0x%x\n", hm);
 #endif
   solv_free(pd->cshash);
-  ht = pd->cshash = (Hashtable)solv_calloc(hm + 1, sizeof(Id));
+  ht = pd->cshash = allochashtable(hm, 1);
   d = pd->csdata;
   de = d + pd->ncsdata;
   while (d != de)
@@ -565,7 +565,7 @@ put_in_cshash(struct parsedata *pd, const unsigned char *key, int keyl, Id id)
   memcpy(d + 1, key, keyl);
   memcpy(d + 1 + keyl, &id, sizeof(Id));
   pd->ncsdata += 1 + keyl + sizeof(Id);
-  if ((Hashval)++pd->ncshash * 2 > hm)
+  if ((Hashval)++pd->ncshash * 2 >= hm)
     {
       pd->cshashm = pd->cshashm ? (2 * pd->cshashm + 1) : 4095;
       rebuild_cshash(pd);