From 26ee533303029d3a4b1b18cb21417b6b2e5d71ae Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Mon, 21 Sep 2015 22:17:26 +0800 Subject: [PATCH] return NULL in memory_mapping() if no memory is mapped. this fixes test_bad_unmap in test_x86.c --- uc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/uc.c b/uc.c index 76a3f5f7..2d97b7c9 100644 --- a/uc.c +++ b/uc.c @@ -809,6 +809,9 @@ MemoryRegion *memory_mapping(struct uc_struct* uc, uint64_t address) { unsigned int i; + if (uc->mapped_block_count == 0) + return NULL; + // try with the cache index first i = uc->mapped_block_cache_index;