map: scale extend with the item size as well

This commit is contained in:
Wim Taymans 2022-02-09 15:17:37 +01:00
parent 9bebad6ed3
commit f743aecd23

View file

@ -115,7 +115,7 @@ struct pw_map {
*/
static inline void pw_map_init(struct pw_map *map, size_t size, size_t extend)
{
pw_array_init(&map->items, extend);
pw_array_init(&map->items, extend * sizeof(union pw_map_item));
pw_array_ensure_size(&map->items, size * sizeof(union pw_map_item));
map->free_list = SPA_ID_INVALID;
}