Free up all MemoryRegion* when uc is closed
This commit is contained in:
parent
00944b6cde
commit
4b529bc56c
@ -47,11 +47,12 @@ MemoryRegion *memory_map(struct uc_struct *uc, ram_addr_t begin, size_t size, ui
|
||||
|
||||
int memory_free(struct uc_struct *uc)
|
||||
{
|
||||
int i;
|
||||
get_system_memory(uc)->enabled = false;
|
||||
if (uc->ram) {
|
||||
uc->ram->enabled = false;
|
||||
memory_region_del_subregion(get_system_memory(uc), uc->ram);
|
||||
g_free(uc->ram);
|
||||
for (i = 0; i < uc->mapped_block_count; i++) {
|
||||
uc->mapped_blocks[i].region->enabled = false;
|
||||
memory_region_del_subregion(get_system_memory(uc), uc->mapped_blocks[i].region);
|
||||
g_free(uc->mapped_blocks[i].region);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
CFLAGS += -I../include
|
||||
LDFLAGS = -L.. -lunicorn
|
||||
|
||||
TESTS = map_crash sigill sigill2 block_test
|
||||
TESTS = map_crash sigill sigill2 block_test ro_mem_test
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user