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:
Nguyen Anh Quynh
2015-10-28 01:26:59 +08:00
parent 3a36e327ab
commit b66a323b19
3 changed files with 4 additions and 3 deletions

2
uc.c
View File

@ -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);
if (!split_region(uc, mr, addr, len, true))
return UC_ERR_NOMEM;
// if we can retrieve the mapping, then no splitting took place
// so unmap here
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;
addr += len;
}
return UC_ERR_OK;
}