mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
osdep: introduce qemu_anon_ram_free to free qemu_anon_ram_alloc-ed memory
We switched from qemu_memalign to mmap() but then we don't modify qemu_vfree() to do a munmap() over free(). Which we cannot do because qemu_vfree() frees memory allocated by qemu_{mem,block}align. Introduce a new function that does the munmap(), luckily the size is available in the RAMBlock. Reported-by: Amos Kong <akong@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Message-id: 1368454796-14989-3-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
6eebf958ab
commit
e7a09b92b7
5 changed files with 20 additions and 6 deletions
|
@ -135,6 +135,14 @@ void qemu_vfree(void *ptr)
|
|||
free(ptr);
|
||||
}
|
||||
|
||||
void qemu_anon_ram_free(void *ptr, size_t size)
|
||||
{
|
||||
trace_qemu_anon_ram_free(ptr, size);
|
||||
if (ptr) {
|
||||
munmap(ptr, size);
|
||||
}
|
||||
}
|
||||
|
||||
void qemu_set_block(int fd)
|
||||
{
|
||||
int f;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue