Skip to content

Commit

Permalink
KVM: kvm->arch.vioapic should be NULL if kvm_ioapic_init() failure
Browse files Browse the repository at this point in the history
kvm->arch.vioapic should be NULL in case of kvm_ioapic_init() failure
due to cannot register io dev.

Signed-off-by: Wei Yongjun <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
  • Loading branch information
Wei Yongjun authored and matosatti committed Mar 1, 2010
1 parent d225f53 commit 1ae77ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion virt/kvm/ioapic.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,10 @@ int kvm_ioapic_init(struct kvm *kvm)
mutex_lock(&kvm->slots_lock);
ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, &ioapic->dev);
mutex_unlock(&kvm->slots_lock);
if (ret < 0)
if (ret < 0) {
kvm->arch.vioapic = NULL;
kfree(ioapic);
}

return ret;
}
Expand Down

0 comments on commit 1ae77ba

Please sign in to comment.