This commit is contained in:
Nguyen Anh Quynh
2015-12-13 13:11:54 +08:00
5 changed files with 119 additions and 11 deletions

View File

@@ -78,13 +78,18 @@ void memory_unmap(struct uc_struct *uc, MemoryRegion *mr)
int memory_free(struct uc_struct *uc)
{
MemoryRegion *mr;
int i;
get_system_memory(uc)->enabled = false;
for (i = 0; i < uc->mapped_block_count; i++) {
uc->mapped_blocks[i]->enabled = false;
memory_region_del_subregion(get_system_memory(uc), uc->mapped_blocks[i]);
g_free(uc->mapped_blocks[i]);
mr = uc->mapped_blocks[i];
mr->enabled = false;
memory_region_del_subregion(get_system_memory(uc), mr);
mr->destructor(mr);
g_free((char *)mr->name);
g_free(mr->ioeventfds);
g_free(mr);
}
return 0;