diff options
author | Gonglei <arei.gonglei@huawei.com> | 2016-03-03 17:43:41 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-04-08 00:07:56 +0200 |
commit | 696b55017d90b3237ca9d656aa4904d6b5c46c7a (patch) | |
tree | 8d337e6ceac1df4cccfab13e3bb4c4e90707aedc | |
parent | 1a5512bb7ef73036a406727397fb58c640074321 (diff) |
hostmem-file: fix memory leak
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Message-Id: <1456998223-12356-5-git-send-email-arei.gonglei@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | backends/hostmem-file.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index c70f268d6f..b17a1f10a2 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -52,11 +52,14 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) error_setg(errp, "-mem-path not supported on this host"); #else if (!memory_region_size(&backend->mr)) { + gchar *path; backend->force_prealloc = mem_prealloc; + path = object_get_canonical_path(OBJECT(backend)); memory_region_init_ram_from_file(&backend->mr, OBJECT(backend), - object_get_canonical_path(OBJECT(backend)), + path, backend->size, fb->share, fb->mem_path, errp); + g_free(path); } #endif } |