diff --git a/devicemodel/core/mem.c b/devicemodel/core/mem.c index 989611b3f..189e989d3 100644 --- a/devicemodel/core/mem.c +++ b/devicemodel/core/mem.c @@ -346,12 +346,12 @@ unregister_mem(struct mem_range *memp) /* flush Per-VM cache */ if (mmio_hint == entry) mmio_hint = NULL; + + if (entry) + free(entry); } pthread_rwlock_unlock(&mmio_rwlock); - if (entry) - free(entry); - return err; }