mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 05:05:36 +00:00
Fix segfault introduced in my previous commits.
This commit is contained in:
parent
f21fa3d966
commit
8b79a872d0
|
@ -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;
|
||||
|
|
8
uc.c
8
uc.c
|
@ -258,7 +258,6 @@ uc_err uc_open(uc_arch arch, uc_mode mode, uc_engine **result)
|
|||
UNICORN_EXPORT
|
||||
uc_err uc_close(uc_engine *uc)
|
||||
{
|
||||
MemoryRegion *mr;
|
||||
int i;
|
||||
|
||||
if (uc->release)
|
||||
|
@ -274,13 +273,6 @@ uc_err uc_close(uc_engine *uc)
|
|||
|
||||
g_free(uc->tcg_ctx);
|
||||
|
||||
for (i = 0; i < uc->mapped_block_count; i++) {
|
||||
mr = uc->mapped_blocks[i];
|
||||
mr->destructor(mr);
|
||||
g_free((char *)mr->name);
|
||||
g_free(mr->ioeventfds);
|
||||
}
|
||||
|
||||
free((void*) uc->system_memory->name);
|
||||
g_free(uc->system_memory);
|
||||
g_hash_table_destroy(uc->type_table);
|
||||
|
|
Loading…
Reference in a new issue