If kvm__check_extensions found that some of the required
KVM extention is not supported by OS, we should stop the
init and free all allocated resources.

Signed-off-by: Yang Bai <hamo...@gmail.com>
---
 tools/kvm/kvm.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c
index 9a0bd67..8e749ad 100644
--- a/tools/kvm/kvm.c
+++ b/tools/kvm/kvm.c
@@ -384,6 +384,7 @@ struct kvm *kvm__init(const char *kvm_dev, const char 
*hugetlbfs_path, u64 ram_s
        if (kvm__check_extensions(kvm)) {
                pr_err("A required KVM extention is not supported by OS");
                ret = -ENOSYS;
+               goto err;
        }
 
        kvm__arch_init(kvm, hugetlbfs_path, ram_size);
-- 
1.7.8.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to