Fix overflow regression

This commit fixes a regression introduced in c039c88 (v0.3.1)
which causes a heap-buffer-overflow during hashmap_free.

fixes #10
pull/13/head v0.3.3
tidwall 4 years ago
parent 30b9a6cc88
commit 5ea678af50

@ -104,7 +104,7 @@ struct hashmap *hashmap_new(size_t elsize, size_t cap,
bucketsz++;
}
// hashmap + spare + edata
size_t size = sizeof(struct hashmap)+bucketsz+elsize;
size_t size = sizeof(struct hashmap)+bucketsz*2;
struct hashmap *map = hmmalloc(size);
if (!map) {
return NULL;

Loading…
Cancel
Save