Commit 696b5501 authored by Gonglei's avatar Gonglei Committed by Paolo Bonzini
Browse files

hostmem-file: fix memory leak



Signed-off-by: default avatarGonglei <arei.gonglei@huawei.com>
Message-Id: <1456998223-12356-5-git-send-email-arei.gonglei@huawei.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 1a5512bb
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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
}