kernel: mmu: fix memory leak in virt_region_alloc()
The error path for an invalid destination address in virt_region_alloc()
frees the allocation using the originally requested 'size' instead of
the 'num_bits' that were actually allocated from the bitmap.
This leaks the virtual address space.
Pass 'num_bits' instead of 'size' to sys_bitarray_free() to ensure the
allocated region is correctly freed.
Signed-off-by:
Mirai SHINJO <oss@mshinjo.com>
Loading
Please sign in to comment