mem: Improve search for existing mapping

When we search for an exaisting mapping, anything that contains
the offset+size range is ok, not just the larger mmapped area.

This fixes a leak where the imported block mapping was not used
and leaked.
This commit is contained in:
Wim Taymans 2020-06-01 18:16:13 +02:00
parent 34dada9c4c
commit 4796673581

View file

@ -349,7 +349,7 @@ struct pw_memmap * pw_memblock_map(struct pw_memblock *block,
pw_map_range_init(&range, offset, size, p->pagesize); pw_map_range_init(&range, offset, size, p->pagesize);
m = memblock_find_mapping(b, flags, range.offset, range.size); m = memblock_find_mapping(b, flags, offset, size);
if (m == NULL) if (m == NULL)
m = memblock_map(b, flags, range.offset, range.size); m = memblock_map(b, flags, range.offset, range.size);
if (m == NULL) if (m == NULL)