diff -r dce04550fbef -r ad5eeb256242 src/hash_map.c --- a/src/hash_map.c Tue Jan 07 18:37:07 2025 +0100 +++ b/src/hash_map.c Tue Jan 07 19:16:03 2025 +0100 @@ -103,7 +103,8 @@ if (elm != NULL && elm->key.hash == hash && elm->key.len == key.len && memcmp(elm->key.data, key.data, key.len) == 0) { - // overwrite existing element + // overwrite existing element, but call destructors first + cx_invoke_destructor(map, elm->data); if (map->collection.store_pointer) { memcpy(elm->data, &value, sizeof(void *)); } else {