Fix segfault introduced in my previous commits.

This commit is contained in:
farmdve
2015-12-11 22:35:25 +02:00
parent f21fa3d966
commit 8b79a872d0
2 changed files with 8 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;