aboutsummaryrefslogtreecommitdiff
path: root/backends/hostmem-ram.c
diff options
context:
space:
mode:
Diffstat (limited to 'backends/hostmem-ram.c')
-rw-r--r--backends/hostmem-ram.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c
index b8e55cdbd0..d121249f0f 100644
--- a/backends/hostmem-ram.c
+++ b/backends/hostmem-ram.c
@@ -16,23 +16,23 @@
#include "qemu/module.h"
#include "qom/object_interfaces.h"
-static void
+static bool
ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
{
+ g_autofree char *name = NULL;
uint32_t ram_flags;
- char *name;
if (!backend->size) {
error_setg(errp, "can't create backend with size 0");
- return;
+ return false;
}
name = host_memory_backend_get_name(backend);
ram_flags = backend->share ? RAM_SHARED : 0;
ram_flags |= backend->reserve ? 0 : RAM_NORESERVE;
- memory_region_init_ram_flags_nomigrate(&backend->mr, OBJECT(backend), name,
- backend->size, ram_flags, errp);
- g_free(name);
+ return memory_region_init_ram_flags_nomigrate(&backend->mr, OBJECT(backend),
+ name, backend->size,
+ ram_flags, errp);
}
static void