do not abort() when memory is insufficient. this fixes issue #244

This commit is contained in:
Nguyen Anh Quynh
2015-11-10 11:44:29 +08:00
parent 87ce40eb00
commit 272293556a
5 changed files with 14 additions and 3 deletions

4
uc.c
View File

@ -593,7 +593,11 @@ uc_err uc_mem_map(uc_engine *uc, uint64_t address, size_t size, uint32_t perms)
}
uc->mapped_blocks = regions;
}
uc->mapped_blocks[uc->mapped_block_count] = uc->memory_map(uc, address, size, perms);
if (uc->mapped_blocks[uc->mapped_block_count] == NULL)
return UC_ERR_NOMEM;
uc->mapped_block_count++;
return UC_ERR_OK;