aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--memory.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/memory.c b/memory.c
index 42317a216d..ef0be1c3aa 100644
--- a/memory.c
+++ b/memory.c
@@ -1309,6 +1309,10 @@ uint64_t memory_region_size(MemoryRegion *mr)
const char *memory_region_name(const MemoryRegion *mr)
{
+ if (!mr->name) {
+ ((MemoryRegion *)mr)->name =
+ object_get_canonical_path_component(OBJECT(mr));
+ }
return mr->name;
}