From: Amit Shah <amit.s...@redhat.com>

Fix a memleak when the KVM_SET_CPUID2 ioctl fails. Free the
memory that we allocate to store cpuids.

Reported-by: Mark McLoughlin <mar...@redhat.com>
Signed-off-by: Amit Shah <amit.s...@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosa...@redhat.com>

diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index 3bbb9d2..350f272 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -535,7 +535,7 @@ int kvm_setup_cpuid2(kvm_vcpu_context_t vcpu, int nent,
        r = ioctl(vcpu->fd, KVM_SET_CPUID2, cpuid);
        if (r == -1) {
                fprintf(stderr, "kvm_setup_cpuid2: %m\n");
-               return -errno;
+               r = -errno;
        }
        free(cpuid);
        return r;
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" 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