aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2009-07-13 14:18:50 +0530
committerMarcelo Tosatti <mtosatti@redhat.com>2009-07-14 19:37:44 -0300
commit91a5fec39e9dcf99b85c6df689933d02f713dd7b (patch)
treed8a26436ea7c9b864b702795bf3c452e0ac12943 /qemu-kvm-x86.c
parentreuse upstream breakpoint code (diff)
downloadqemu-kvm-91a5fec39e9dcf99b85c6df689933d02f713dd7b.tar.gz
qemu-kvm-91a5fec39e9dcf99b85c6df689933d02f713dd7b.tar.bz2
qemu-kvm-91a5fec39e9dcf99b85c6df689933d02f713dd7b.zip
qemu-kvm: x86: fix memleak if ioctl fails
Fix a memleak when the KVM_SET_CPUID2 ioctl fails. Free the memory that we allocate to store cpuids. Reported-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'qemu-kvm-x86.c')
-rw-r--r--qemu-kvm-x86.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index 3bbb9d25a..350f272d7 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;