mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-09 01:15:40 +00:00
do not free MemoryRegion in memory_unmap() because it will be unref later in memory_region_unref(). this fixes issue #202
This commit is contained in:
parent
3a36e327ab
commit
b66a323b19
|
@ -49,6 +49,7 @@ void memory_unmap(struct uc_struct *uc, MemoryRegion *mr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
target_ulong addr;
|
target_ulong addr;
|
||||||
|
|
||||||
// Make sure all pages associated with the MemoryRegion are flushed
|
// Make sure all pages associated with the MemoryRegion are flushed
|
||||||
// Only need to do this if we are in a running state
|
// Only need to do this if we are in a running state
|
||||||
if (uc->current_cpu) {
|
if (uc->current_cpu) {
|
||||||
|
@ -67,8 +68,6 @@ void memory_unmap(struct uc_struct *uc, MemoryRegion *mr)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free(mr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int memory_free(struct uc_struct *uc)
|
int memory_free(struct uc_struct *uc)
|
||||||
|
|
2
uc.c
2
uc.c
|
@ -793,6 +793,7 @@ uc_err uc_mem_unmap(struct uc_struct *uc, uint64_t address, size_t size)
|
||||||
len = MIN(size - count, mr->end - addr);
|
len = MIN(size - count, mr->end - addr);
|
||||||
if (!split_region(uc, mr, addr, len, true))
|
if (!split_region(uc, mr, addr, len, true))
|
||||||
return UC_ERR_NOMEM;
|
return UC_ERR_NOMEM;
|
||||||
|
|
||||||
// if we can retrieve the mapping, then no splitting took place
|
// if we can retrieve the mapping, then no splitting took place
|
||||||
// so unmap here
|
// so unmap here
|
||||||
mr = memory_mapping(uc, addr);
|
mr = memory_mapping(uc, addr);
|
||||||
|
@ -801,6 +802,7 @@ uc_err uc_mem_unmap(struct uc_struct *uc, uint64_t address, size_t size)
|
||||||
count += len;
|
count += len;
|
||||||
addr += len;
|
addr += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
return UC_ERR_OK;
|
return UC_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue